Class: MuffinMan::SpApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/muffin_man/sp_api_client.rb

Constant Summary collapse

ACCESS_TOKEN_URL =
"https://api.amazon.com/auth/o2/token".freeze
SERVICE_NAME =
"execute-api".freeze
AWS_REGION_MAP =
{
  "na" => "us-east-1",
  "eu" => "eu-west-1",
  "fe" => "us-west-2"
}.freeze
UNPROCESSABLE_ENTITY_STATUS_CODE =
422

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials, sandbox = false) ⇒ SpApiClient

Returns a new instance of SpApiClient.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/muffin_man/sp_api_client.rb', line 25

def initialize(credentials, sandbox = false)
  @refresh_token = credentials[:refresh_token]
  @client_id = credentials[:client_id]
  @client_secret = credentials[:client_secret]
  @aws_access_key_id = credentials[:aws_access_key_id]
  @aws_secret_access_key = credentials[:aws_secret_access_key]
  @sts_iam_role_arn = credentials[:sts_iam_role_arn]
  @region = credentials[:region] || "na"
  @scope = credentials[:scope]
  @access_token_cache_key = credentials[:access_token_cache_key]
  @sandbox = sandbox
  @credentials = credentials
  @pii_data_elements = []
  Typhoeus::Config.user_agent = ""
  @config = MuffinMan.configuration
end

Instance Attribute Details

#access_token_cache_keyObject (readonly)

Returns the value of attribute access_token_cache_key.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def access_token_cache_key
  @access_token_cache_key
end

#aws_access_key_idObject (readonly)

Returns the value of attribute aws_access_key_id.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def aws_access_key_id
  @aws_access_key_id
end

#aws_secret_access_keyObject (readonly)

Returns the value of attribute aws_secret_access_key.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def aws_secret_access_key
  @aws_secret_access_key
end

#client_idObject (readonly)

Returns the value of attribute client_id.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def client_id
  @client_id
end

#client_secretObject (readonly)

Returns the value of attribute client_secret.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def client_secret
  @client_secret
end

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def config
  @config
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def credentials
  @credentials
end

#local_var_pathObject (readonly)

Returns the value of attribute local_var_path.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def local_var_path
  @local_var_path
end

#pii_data_elementsObject (readonly)

Returns the value of attribute pii_data_elements.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def pii_data_elements
  @pii_data_elements
end

#query_paramsObject (readonly)

Returns the value of attribute query_params.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def query_params
  @query_params
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def refresh_token
  @refresh_token
end

#regionObject (readonly)

Returns the value of attribute region.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def region
  @region
end

#request_bodyObject (readonly)

Returns the value of attribute request_body.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def request_body
  @request_body
end

#request_typeObject (readonly)

Returns the value of attribute request_type.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def request_type
  @request_type
end

#sandboxObject (readonly)

Returns the value of attribute sandbox.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def sandbox
  @sandbox
end

#scopeObject (readonly)

Returns the value of attribute scope.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def scope
  @scope
end

#sts_iam_role_arnObject (readonly)

Returns the value of attribute sts_iam_role_arn.



9
10
11
# File 'lib/muffin_man/sp_api_client.rb', line 9

def sts_iam_role_arn
  @sts_iam_role_arn
end