Changeset 5
- Timestamp:
- Mar 14, 2013, 7:55:02 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/synapse/source/lib/laz_synapse.lpk
r2 r5 1 1 <?xml version="1.0"?> 2 2 <CONFIG> 3 <Package Version=" 3">3 <Package Version="4"> 4 4 <Name Value="laz_synapse"/> 5 <AddToProjectUsesSection Value="True"/> 5 6 <CompilerOptions> 6 <Version Value=" 8"/>7 <Version Value="11"/> 7 8 <SearchPaths> 8 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS) /"/>9 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 9 10 </SearchPaths> 10 <Parsing>11 <SyntaxOptions>12 <UseAnsiStrings Value="True"/>13 </SyntaxOptions>14 </Parsing>15 11 <Other> 16 12 <CompilerPath Value="$(CompPath)"/> 17 13 </Other> 18 14 </CompilerOptions> 19 <Files Count="3 3">15 <Files Count="34"> 20 16 <Item1> 21 17 <Filename Value="asn1util.pas"/> … … 95 91 </Item19> 96 92 <Item20> 97 <Filename Value="ssfpc.pas"/> 98 <AddToUsesPkgSection Value="False"/> 99 <UnitName Value="ssfpc"/> 93 <Filename Value="synachar.pas"/> 94 <UnitName Value="synachar"/> 100 95 </Item20> 101 96 <Item21> 102 <Filename Value="sswin32.pas"/> 103 <AddToUsesPkgSection Value="False"/> 104 <UnitName Value="sswin32"/> 97 <Filename Value="synacode.pas"/> 98 <UnitName Value="synacode"/> 105 99 </Item21> 106 100 <Item22> 107 <Filename Value="synac har.pas"/>108 <UnitName Value="synac har"/>101 <Filename Value="synacrypt.pas"/> 102 <UnitName Value="synacrypt"/> 109 103 </Item22> 110 104 <Item23> 111 <Filename Value="syna code.pas"/>112 <UnitName Value="syna code"/>105 <Filename Value="synadbg.pas"/> 106 <UnitName Value="synadbg"/> 113 107 </Item23> 114 108 <Item24> 115 <Filename Value="syna crypt.pas"/>116 <UnitName Value="syna crypt"/>109 <Filename Value="synafpc.pas"/> 110 <UnitName Value="synafpc"/> 117 111 </Item24> 118 112 <Item25> 119 <Filename Value="syna dbg.pas"/>120 <UnitName Value="syna dbg"/>113 <Filename Value="synaicnv.pas"/> 114 <UnitName Value="synaicnv"/> 121 115 </Item25> 122 116 <Item26> 123 <Filename Value="syna fpc.pas"/>124 <UnitName Value="syna fpc"/>117 <Filename Value="synaip.pas"/> 118 <UnitName Value="synaip"/> 125 119 </Item26> 126 120 <Item27> 127 <Filename Value="syna icnv.pas"/>128 <UnitName Value="syna icnv"/>121 <Filename Value="synamisc.pas"/> 122 <UnitName Value="synamisc"/> 129 123 </Item27> 130 124 <Item28> 131 <Filename Value="syna ip.pas"/>132 <UnitName Value="syna ip"/>125 <Filename Value="synaser.pas"/> 126 <UnitName Value="synaser"/> 133 127 </Item28> 134 128 <Item29> 135 <Filename Value="syna misc.pas"/>136 <UnitName Value="syna misc"/>129 <Filename Value="synautil.pas"/> 130 <UnitName Value="synautil"/> 137 131 </Item29> 138 132 <Item30> 139 <Filename Value="syn aser.pas"/>140 <UnitName Value="syn aser"/>133 <Filename Value="synsock.pas"/> 134 <UnitName Value="synsock"/> 141 135 </Item30> 142 136 <Item31> 143 <Filename Value=" synautil.pas"/>144 <UnitName Value=" synautil"/>137 <Filename Value="tlntsend.pas"/> 138 <UnitName Value="tlntsend"/> 145 139 </Item31> 146 140 <Item32> 147 <Filename Value="s ynsock.pas"/>148 <UnitName Value="s ynsock"/>141 <Filename Value="ssl_openssl.pas"/> 142 <UnitName Value="ssl_openssl"/> 149 143 </Item32> 150 144 <Item33> 151 <Filename Value=" tlntsend.pas"/>152 <UnitName Value=" tlntsend"/>145 <Filename Value="ssl_openssl_lib.pas"/> 146 <UnitName Value="ssl_openssl_lib"/> 153 147 </Item33> 148 <Item34> 149 <Filename Value="ssfpc.inc"/> 150 <Type Value="Include"/> 151 </Item34> 154 152 </Files> 155 153 <Type Value="RunAndDesignTime"/> -
trunk/Packages/synapse/source/lib/laz_synapse.pas
r2 r5 3 3 } 4 4 5 unit laz_synapse; 5 unit laz_synapse; 6 6 7 7 interface 8 8 9 9 uses 10 10 asn1util, blcksock, clamsend, dnssend, ftpsend, ftptsend, httpsend, 11 11 imapsend, ldapsend, mimeinln, mimemess, mimepart, nntpsend, pingsend, 12 12 pop3send, slogsend, smtpsend, snmpsend, sntpsend, synachar, synacode, 13 13 synacrypt, synadbg, synafpc, synaicnv, synaip, synamisc, synaser, synautil, 14 synsock, tlntsend, LazarusPackageIntf;14 synsock, tlntsend, ssl_openssl, ssl_openssl_lib, LazarusPackageIntf; 15 15 16 16 implementation 17 17 18 procedure Register; 18 procedure Register; 19 19 begin 20 end; 20 end; 21 21 22 22 initialization 23 RegisterPackage('laz_synapse', @Register); 23 RegisterPackage('laz_synapse', @Register); 24 24 end. -
trunk/UFioAPI.pas
r4 r5 6 6 7 7 uses 8 Classes, SysUtils, httpsend ;8 Classes, SysUtils, httpsend, ssl_openssl; 9 9 10 10 type … … 13 13 14 14 TFioAPI = class 15 private 16 function Download(URL: string; Data: TStrings): Boolean; 17 public 15 18 Token: string; 16 19 Format: string; 17 function Download: Boolean; 20 function DownloadInterval(TimeFrom, TimeTo: TDateTime; Data: TStrings): Boolean; 21 function DownloadMonthly(Year, Id: Integer; Data: TStrings): Boolean; 22 function DownloadLast(Data: TStrings): Boolean; 18 23 end; 19 24 … … 22 27 { TFioAPI } 23 28 24 function TFioAPI.Download : Boolean;29 function TFioAPI.Download(URL: string; Data: TStrings): Boolean; 25 30 var 26 31 HTTPSender: THTTPSend; … … 30 35 Format := 'xml'; 31 36 Token := 'dd'; 32 // HTTPSender.HTTPMethod('GET', 'https://www.fio.cz/ib_api/rest/periods/' + Token + 33 // '/2013-03-01/2013-03-15/transactions.' + Format); 34 HTTPSender.HTTPMethod('GET', 'https://www.fio.cz/e-broker/e-broker.cgi'); 37 HTTPSender.HTTPMethod('GET', URL); 35 38 try 36 39 case HTTPSender.Resultcode of 37 40 100..299: 38 41 begin 39 { with TFileStream.Create(TargetFile, fmCreate or fmOpenWrite) do 40 try 41 Seek(0, soFromBeginning); 42 CopyFrom(HTTPSender.Document, 0); 43 finally 44 Free; 45 end;} 42 Data.LoadFromStream(HTTPSender.Document); 46 43 Result := True; 47 44 end; //informational, success … … 53 50 except 54 51 // We don't care for the reason for this error; the download failed. 55 Result := false;52 Result := False; 56 53 end; 57 54 finally … … 60 57 end; 61 58 59 function TFioAPI.DownloadInterval(TimeFrom, TimeTo: TDateTime; Data: TStrings 60 ): Boolean; 61 begin 62 Result := Download('https://www.fio.cz/ib_api/rest/periods/' + Token + 63 '/' + FormatDateTime('yyyy-mm-dd', TimeFrom) + 64 '/' + FormatDateTime('yyyy-mm-dd', TimeTo) + 65 '/transactions.' + Format, Data); 66 end; 67 68 function TFioAPI.DownloadMonthly(Year, Id: Integer; Data: TStrings): Boolean; 69 begin 70 Result := Download('https://www.fio.cz/ib_api/rest/by-id/' + Token + 71 '/' + IntToStr(Year) + '/' + IntToStr(Id) + 72 '/transactions.' + Format, Data); 73 end; 74 75 function TFioAPI.DownloadLast(Data: TStrings): Boolean; 76 begin 77 Result := Download('https://www.fio.cz/ib_api/rest/last/' + Token + 78 '/transactions.' + Format, Data); 79 end; 80 62 81 end. 63 82 -
trunk/UFormMain.lfm
r4 r5 26 26 end 27 27 object Button1: TButton 28 Left = 5628 Left = 16 29 29 Height = 25 30 Top = 18430 Top = 344 31 31 Width = 112 32 32 Action = ADownload 33 33 TabOrder = 1 34 end 35 object Memo1: TMemo 36 Left = 16 37 Height = 271 38 Top = 56 39 Width = 453 40 TabOrder = 2 34 41 end 35 42 object TrayIcon1: TTrayIcon -
trunk/UFormMain.pas
r4 r5 21 21 ImageList1: TImageList; 22 22 LabeledEdit1: TLabeledEdit; 23 Memo1: TMemo; 23 24 MenuItem1: TMenuItem; 24 25 MenuItem2: TMenuItem; … … 59 60 FioAPI := TFioAPI.Create; 60 61 try 61 FioAPI.Download; 62 FioAPI.Token := LabeledEdit1.Text; 63 FioAPI.Format := 'xml'; 64 FioAPI.DownloadInterval(EncodeDate(2013, 03, 01), EncodeDate(2013, 03, 14), 65 Memo1.Lines); 62 66 finally 63 67 FioAPI.Free;
Note:
See TracChangeset
for help on using the changeset viewer.