Class: AmznSpApi::SpApiConfiguration
- Inherits:
-
Configuration
- Object
- Configuration
- AmznSpApi::SpApiConfiguration
- Defined in:
- lib/amzn_sp_api/sp_api_configuration.rb
Constant Summary collapse
- SCOPE =
%w[sellingpartnerapi::notifications sellingpartnerapi::migration]
- AWS_REGION_MAP =
{ 'na' => 'us-east-1', 'eu' => 'eu-west-1', 'fe' => 'us-west-2' }.freeze
Instance Attribute Summary collapse
-
#aws_access_key_id ⇒ Object
The AWS access key Id.
-
#aws_secret_access_key ⇒ Object
The AWS secret access key,.
-
#client_id ⇒ Object
The LWA client identifier.
-
#client_secret ⇒ Object
The LWA client secret.
-
#credentials_provider ⇒ Object
Either access key or credentials_provider for AWS Signer, e.g.
-
#get_access_token ⇒ Object
Returns the value of attribute get_access_token.
-
#grant_type ⇒ Object
The type of access grant requested.
-
#refresh_token ⇒ Object
The LWA refresh token.
-
#region ⇒ Object
The AWS region to which you are directing your call.
-
#sandbox ⇒ Object
The Selling Partner API provides two sandbox environments: static and dynamic.
-
#save_access_token ⇒ Object
Optional lambdas for storing and retrieving token.
-
#scope ⇒ Object
The scope of the LWA authorization grant.
Attributes inherited from Configuration
#access_token, #api_key, #api_key_prefix, #base_path, #cert_file, #client_side_validation, #debugging, #force_ending_format, #host, #inject_format, #key_file, #logger, #params_encoding, #password, #scheme, #ssl_ca_cert, #temp_folder_path, #timeout, #username, #verify_ssl, #verify_ssl_host
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Configuration
#api_key_with_prefix, #auth_settings, #base_url, #basic_auth_token, #configure, #initialize
Constructor Details
This class inherits a constructor from AmznSpApi::Configuration
Instance Attribute Details
#aws_access_key_id ⇒ Object
The AWS access key Id
32 33 34 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 32 def aws_access_key_id @aws_access_key_id end |
#aws_secret_access_key ⇒ Object
The AWS secret access key,
35 36 37 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 35 def aws_secret_access_key @aws_secret_access_key end |
#client_id ⇒ Object
The LWA client identifier.
20 21 22 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 20 def client_id @client_id end |
#client_secret ⇒ Object
The LWA client secret.
23 24 25 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 23 def client_secret @client_secret end |
#credentials_provider ⇒ Object
Either access key or credentials_provider for AWS Signer, e.g. Aws::STS::Client
38 39 40 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 38 def credentials_provider @credentials_provider end |
#get_access_token ⇒ Object
Returns the value of attribute get_access_token.
43 44 45 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 43 def get_access_token @get_access_token end |
#grant_type ⇒ Object
The type of access grant requested. @values: refresh_token Use this for calling operations that require authorization from a selling partner. All operations that are not grantless operations require authorization from a selling partner. When specifying this value, include the refresh_token parameter. @values: client_credentials Use this for calling grantless operations. When specifying this value, include the parameter.scope
9 10 11 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 9 def grant_type @grant_type end |
#refresh_token ⇒ Object
The LWA refresh token.
12 13 14 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 12 def refresh_token @refresh_token end |
#region ⇒ Object
The AWS region to which you are directing your call.
29 30 31 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 29 def region @region end |
#sandbox ⇒ Object
The Selling Partner API provides two sandbox environments: static and dynamic
26 27 28 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 26 def sandbox @sandbox end |
#save_access_token ⇒ Object
Optional lambdas for storing and retrieving token
41 42 43 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 41 def save_access_token @save_access_token end |
#scope ⇒ Object
The scope of the LWA authorization grant. @values: sellingpartnerapi::notifications. For the Notifications API. @values: sellingpartnerapi::migration. For the Authorization API.
17 18 19 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 17 def scope @scope end |
Class Method Details
.default ⇒ Object
76 77 78 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 76 def self.default @@default ||= SpApiConfiguration.new end |
Instance Method Details
#access_token_key ⇒ Object
72 73 74 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 72 def access_token_key Digest::MD5.hexdigest("#{client_id} #{refresh_token}") end |
#aws_region ⇒ Object
55 56 57 |
# File 'lib/amzn_sp_api/sp_api_configuration.rb', line 55 def aws_region AWS_REGION_MAP[region] end |