Class: AmznSpApi::AuthorizationApiModel::AuthorizationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/authorization_api_model/api/authorization_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AuthorizationApi



14
15
16
# File 'lib/authorization_api_model/api/authorization_api.rb', line 14

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



12
13
14
# File 'lib/authorization_api_model/api/authorization_api.rb', line 12

def api_client
  @api_client
end

Instance Method Details

#get_authorization_code(selling_partner_id, developer_id, mws_auth_token, opts = {}) ⇒ GetAuthorizationCodeResponse

Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization. With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller’s behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 1 | 5 | For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.



25
26
27
28
# File 'lib/authorization_api_model/api/authorization_api.rb', line 25

def get_authorization_code(selling_partner_id, developer_id, mws_auth_token, opts = {})
  data, _status_code, _headers = get_authorization_code_with_http_info(selling_partner_id, developer_id, mws_auth_token, opts)
  data
end

#get_authorization_code_with_http_info(selling_partner_id, developer_id, mws_auth_token, opts = {}) ⇒ Array<(GetAuthorizationCodeResponse, Integer, Hash)>

Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization. With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller&#x27;s behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 1 | 5 | For more information, see &quot;Usage Plans and Rate Limits&quot; in the Selling Partner API documentation.

Raises:

  • (ArgumentError)


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/authorization_api_model/api/authorization_api.rb', line 37

def get_authorization_code_with_http_info(selling_partner_id, developer_id, mws_auth_token, opts = {})
  @api_client.config.logger.debug 'Calling API: AuthorizationApi.get_authorization_code ...' if @api_client.config.debugging
  # verify the required parameter 'selling_partner_id' is set
  raise ArgumentError, "Missing the required parameter 'selling_partner_id' when calling AuthorizationApi.get_authorization_code" if @api_client.config.client_side_validation && selling_partner_id.nil?
  # verify the required parameter 'developer_id' is set
  raise ArgumentError, "Missing the required parameter 'developer_id' when calling AuthorizationApi.get_authorization_code" if @api_client.config.client_side_validation && developer_id.nil?
  # verify the required parameter 'mws_auth_token' is set
  raise ArgumentError, "Missing the required parameter 'mws_auth_token' when calling AuthorizationApi.get_authorization_code" if @api_client.config.client_side_validation && mws_auth_token.nil?

  # resource path
  local_var_path = '/authorization/v1/authorizationCode'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:sellingPartnerId] = selling_partner_id
  query_params[:developerId] = developer_id
  query_params[:mwsAuthToken] = mws_auth_token

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'payload', 'errors'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body]

  return_type = opts[:return_type] || 'GetAuthorizationCodeResponse'

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    auth_names: auth_names,
                                                    return_type: return_type)

  @api_client.config.logger.debug "API called: AuthorizationApi#get_authorization_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end