Class: RmsApiRuby::RestApi::Base

Inherits:
Object
  • Object
show all
Includes:
HashKeysCamelizable, Waterfall
Defined in:
lib/rms_api_ruby/rest_api/base.rb

Direct Known Subclasses

Item::Base, Navigation::Base, Product::Client

Instance Method Summary collapse

Methods included from HashKeysCamelizable

#camelize_keys

Constructor Details

#initialize(args, client_class = RmsApiRuby::Chain::HttpClient) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
16
17
18
19
# File 'lib/rms_api_ruby/rest_api/base.rb', line 10

def initialize(args, client_class = RmsApiRuby::Chain::HttpClient)
  @args   = args
  @client = client_class.new(
    method: http_method,
    url: url,
    params: form_params(args),
    headers: http_headers,
    return_method: :result
  )
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'lib/rms_api_ruby/rest_api/base.rb', line 21

def call
  chain { log :info, start_message }
  chain(response: :response) { @client.call }
  chain { log :info, complete_message }
end