Class: LemonWay::Client
- Inherits:
-
Object
- Object
- LemonWay::Client
- Includes:
- HTTParty
- Defined in:
- lib/lemon_way/client.rb
Constant Summary collapse
- DIRECTKIT_URL =
'https://sandbox-api.lemonway.fr/mb/{company_name}/{env}/directkitjson2/Service.asmx'.freeze
- REQUIRED_CONFIGURATION =
%i[login password company].freeze
- DEFAULT_LANGUAGE =
'fr'.freeze
- DEFAULT_HEADERS =
{ 'Content-Type' => 'application/json; charset=utf-8', 'Accept' => 'application/json', 'Cache-Control' => 'no-cache', 'Pragma' => 'no-cache' }.freeze
Instance Attribute Summary collapse
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#society_wallet_id ⇒ Object
readonly
Returns the value of attribute society_wallet_id.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #send_request(lw_method, version, params = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lemon_way/client.rb', line 28 def initialize( = {}) if (.keys & REQUIRED_CONFIGURATION).size != REQUIRED_CONFIGURATION.size raise MissingConfigurationError.new end %i[login password company society_wallet_id].each do |key| instance_variable_set("@#{key}".to_sym, .delete(key)) end @env = [:sandbox] ? 'dev' : 'prod' @options = end |
Instance Attribute Details
#company ⇒ Object (readonly)
Returns the value of attribute company.
23 24 25 |
# File 'lib/lemon_way/client.rb', line 23 def company @company end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
23 24 25 |
# File 'lib/lemon_way/client.rb', line 23 def env @env end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
23 24 25 |
# File 'lib/lemon_way/client.rb', line 23 def login @login end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
23 24 25 |
# File 'lib/lemon_way/client.rb', line 23 def @options end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
23 24 25 |
# File 'lib/lemon_way/client.rb', line 23 def password @password end |
#society_wallet_id ⇒ Object (readonly)
Returns the value of attribute society_wallet_id.
23 24 25 |
# File 'lib/lemon_way/client.rb', line 23 def society_wallet_id @society_wallet_id end |
Instance Method Details
#send_request(lw_method, version, params = {}) ⇒ Object
41 42 43 44 45 |
# File 'lib/lemon_way/client.rb', line 41 def send_request(lw_method, version, params = {}) response = perform_request(lw_method, version, params) ResponseAdapter.new(response) end |