Class: Drebedengi::Client
- Inherits:
-
Object
- Object
- Drebedengi::Client
- Defined in:
- lib/drebedengi/client.rb
Instance Attribute Summary collapse
-
#api_creds ⇒ Object
Returns the value of attribute api_creds.
Instance Method Summary collapse
- #client ⇒ Object
- #get_balance ⇒ Object
- #get_place_list ⇒ Object
-
#get_record_list(**kwargs) ⇒ Object
Gets transactions.
-
#initialize ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 |
# File 'lib/drebedengi/client.rb', line 15 def initialize @api_creds = { apiId: 'demo_api', login: '[email protected]', pass: 'demo', } end |
Instance Attribute Details
#api_creds ⇒ Object
Returns the value of attribute api_creds.
13 14 15 |
# File 'lib/drebedengi/client.rb', line 13 def api_creds @api_creds end |
Instance Method Details
#client ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/drebedengi/client.rb', line 48 def client @client ||= ::Savon.client( wsdl: 'http://www.drebedengi.ru/soap/dd.wsdl', # proxy: 'http://localhost:8888', namespaces: { 'xmlns:ns2' => 'http://xml.apache.org/xml-soap', 'xmlns:SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/', }, ) end |
#get_balance ⇒ Object
23 24 25 26 |
# File 'lib/drebedengi/client.rb', line 23 def get_balance raw_response = client.call(:get_balance, message: api_creds) Responses::GetBalance.new(raw_response.body).places end |
#get_place_list ⇒ Object
28 29 30 31 |
# File 'lib/drebedengi/client.rb', line 28 def get_place_list raw_response = client.call(:get_place_list, message: api_creds) Responses::GetPlaceList.new(raw_response.body).places end |
#get_record_list(**kwargs) ⇒ Object
Gets transactions
38 39 40 41 42 43 44 45 46 |
# File 'lib/drebedengi/client.rb', line 38 def get_record_list(**kwargs) raw_response = client.call( :get_record_list, message: ParameterBuilders::GetRecordList.new(**kwargs), soap_header: { "OpToken" => "secret" }, ) Responses::GetRecordList.new(raw_response.body).records end |