Class: AmzSpApi::RestrictedSpApiClient

Inherits:
ApiClient
  • Object
show all
Defined in:
lib/restricted_sp_api_client.rb

Instance Attribute Summary

Attributes inherited from ApiClient

#config, #default_headers

Instance Method Summary collapse

Methods inherited from ApiClient

#build_collection_param, #build_request, #build_request_body, #build_request_url, #convert_to_type, default, #deserialize, #download_file, #json_mime?, #object_to_hash, #object_to_http_body, #sanitize_filename, #select_header_accept, #select_header_content_type, #update_params_for_auth!, #user_agent=

Constructor Details

#initialize(create_restricted_data_token_request, config = SpConfiguration.default) ⇒ RestrictedSpApiClient

Returns a new instance of RestrictedSpApiClient.



11
12
13
14
15
16
17
# File 'lib/restricted_sp_api_client.rb', line 11

def initialize(create_restricted_data_token_request, config = SpConfiguration.default)
  super(config)
  raise "pass create_restricted_data_token_request to RestrictedSpApiClient.new" if create_restricted_data_token_request.kind_of?(Configuration)
  @wrapped_client = SpApiClient.new(config)
  @create_restricted_data_token_request = create_restricted_data_token_request
  @cache_key = config.access_token_key + "-RDT-" + Digest::MD5.hexdigest(create_restricted_data_token_request.to_s)
end

Instance Method Details

#call_api(http_method, path, opts = {}) ⇒ Object



20
21
22
23
24
25
# File 'lib/restricted_sp_api_client.rb', line 20

def call_api(http_method, path, opts = {})
  unsigned_request = build_request(http_method, path, opts)
  aws_headers = auth_headers(http_method, unsigned_request.url, unsigned_request.encoded_body)
  signed_opts = opts.merge(:header_params => aws_headers.merge(opts[:header_params] || {}))
  super(http_method, path, signed_opts)
end

#super_call_apiObject



19
# File 'lib/restricted_sp_api_client.rb', line 19

alias_method :super_call_api, :call_api