Class: Allegro::WebApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/allegro/webapi/client.rb

Constant Summary collapse

END_POINT =
'https://webapi.allegro.pl/service.php?wsdl'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



9
10
11
# File 'lib/allegro/webapi/client.rb', line 9

def initialize
  yield self
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/allegro/webapi/client.rb', line 7

def client
  @client
end

#country_codeObject

Returns the value of attribute country_code.



6
7
8
# File 'lib/allegro/webapi/client.rb', line 6

def country_code
  @country_code
end

#local_versionObject

Returns the value of attribute local_version.



6
7
8
# File 'lib/allegro/webapi/client.rb', line 6

def local_version
  @local_version
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/allegro/webapi/client.rb', line 7

def password
  @password
end

#session_handleObject (readonly)

Returns the value of attribute session_handle.



7
8
9
# File 'lib/allegro/webapi/client.rb', line 7

def session_handle
  @session_handle
end

#user_loginObject

Returns the value of attribute user_login.



6
7
8
# File 'lib/allegro/webapi/client.rb', line 6

def 
  @user_login
end

#webapi_keyObject

Returns the value of attribute webapi_key.



6
7
8
# File 'lib/allegro/webapi/client.rb', line 6

def webapi_key
  @webapi_key
end

Instance Method Details

#call(operation_name, locals = {}) ⇒ Object



19
20
21
# File 'lib/allegro/webapi/client.rb', line 19

def call(operation_name, locals= {})
  client.call(operation_name, locals)
end

#loginObject



23
24
25
26
27
28
29
# File 'lib/allegro/webapi/client.rb', line 23

def 
  start_client
  message =  {user_login: , user_hash_password: password, country_code: country_code, webapi_key: webapi_key, local_version: local_version}
  response = client.call(:do_login_enc, message: message)
  set_session_handle(response)
  self
end

#set_session_handle(login_response) ⇒ Object



31
32
33
# File 'lib/allegro/webapi/client.rb', line 31

def set_session_handle()
  @session_handle = .body[:do_login_enc_response][:session_handle_part]
end