Class: AmznSpApi::OrdersApiModel::ApprovalsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/orders_api_model/api/approvals_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ApprovalsApi

Returns a new instance of ApprovalsApi.



14
15
16
# File 'lib/orders_api_model/api/approvals_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/orders_api_model/api/approvals_api.rb', line 12

def api_client
  @api_client
end

Instance Method Details

#get_order_items_approvals(order_id, opts = {}) ⇒ GetOrderApprovalsResponse

Returns detailed order items approvals information for the order specified. If NextToken is provided, it’s used to retrieve the next page of order items approvals. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | —- | —- | —- | |Default| 0.5 | 30 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.

Parameters:

  • order_id

    An Amazon-defined order identifier, in 3-7-7 format, e.g. 933-1671587-0818628.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :next_token (String)

    A string token returned in the response of your previous request.

  • :item_approval_types (Array<ItemApprovalType>)

    When set, only return approvals for items which approval type is contained in the specified approval types.

  • :item_approval_status (Array<ItemApprovalStatus>)

    When set, only return approvals that contain items which approval status is contained in the specified approval status.

Returns:



25
26
27
28
# File 'lib/orders_api_model/api/approvals_api.rb', line 25

def get_order_items_approvals(order_id, opts = {})
  data, _status_code, _headers = get_order_items_approvals_with_http_info(order_id, opts)
  data
end

#get_order_items_approvals_with_http_info(order_id, opts = {}) ⇒ Array<(GetOrderApprovalsResponse, Integer, Hash)>

Returns detailed order items approvals information for the order specified. If NextToken is provided, it&#x27;s used to retrieve the next page of order items approvals. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | —- | —- | —- | |Default| 0.5 | 30 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see &quot;Usage Plans and Rate Limits&quot; in the Selling Partner API documentation.

Parameters:

  • order_id

    An Amazon-defined order identifier, in 3-7-7 format, e.g. 933-1671587-0818628.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :next_token (String)

    A string token returned in the response of your previous request.

  • :item_approval_types (Array<ItemApprovalType>)

    When set, only return approvals for items which approval type is contained in the specified approval types.

  • :item_approval_status (Array<ItemApprovalStatus>)

    When set, only return approvals that contain items which approval status is contained in the specified approval status.

Returns:

  • (Array<(GetOrderApprovalsResponse, Integer, Hash)>)

    GetOrderApprovalsResponse data, response status code and response headers

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
# File 'lib/orders_api_model/api/approvals_api.rb', line 37

def get_order_items_approvals_with_http_info(order_id, opts = {})
  @api_client.config.logger.debug 'Calling API: ApprovalsApi.get_order_items_approvals ...' if @api_client.config.debugging
  # verify the required parameter 'order_id' is set
  raise ArgumentError, "Missing the required parameter 'order_id' when calling ApprovalsApi.get_order_items_approvals" if @api_client.config.client_side_validation && order_id.nil?

  # resource path
  local_var_path = '/orders/v0/orders/{orderId}/approvals'.sub('{' + 'orderId' + '}', order_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:NextToken] = opts[:next_token] unless opts[:next_token].nil?
  query_params[:ItemApprovalTypes] = @api_client.build_collection_param(opts[:item_approval_types], :csv) unless opts[:item_approval_types].nil?
  query_params[:ItemApprovalStatus] = @api_client.build_collection_param(opts[:item_approval_status], :csv) unless opts[:item_approval_status].nil?

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

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

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

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

  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: ApprovalsApi#get_order_items_approvals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end

#update_order_items_approvals(body, order_id, opts = {}) ⇒ nil

Update the order items approvals for an order that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 5 | 15 | The ‘x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • body

    The request body for the updateOrderItemsApprovals operation.

  • order_id

    An Amazon-defined order identifier, in 3-7-7 format.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


82
83
84
85
# File 'lib/orders_api_model/api/approvals_api.rb', line 82

def update_order_items_approvals(body, order_id, opts = {})
  update_order_items_approvals_with_http_info(body, order_id, opts)
  nil
end

#update_order_items_approvals_with_http_info(body, order_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update the order items approvals for an order that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 5 | 15 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • body

    The request body for the updateOrderItemsApprovals operation.

  • order_id

    An Amazon-defined order identifier, in 3-7-7 format.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers

Raises:

  • (ArgumentError)


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/orders_api_model/api/approvals_api.rb', line 92

def update_order_items_approvals_with_http_info(body, order_id, opts = {})
  @api_client.config.logger.debug 'Calling API: ApprovalsApi.update_order_items_approvals ...' if @api_client.config.debugging
  # verify the required parameter 'body' is set
  raise ArgumentError, "Missing the required parameter 'body' when calling ApprovalsApi.update_order_items_approvals" if @api_client.config.client_side_validation && body.nil?
  # verify the required parameter 'order_id' is set
  raise ArgumentError, "Missing the required parameter 'order_id' when calling ApprovalsApi.update_order_items_approvals" if @api_client.config.client_side_validation && order_id.nil?

  # resource path
  local_var_path = '/orders/v0/orders/{orderId}/approvals'.sub('{' + 'orderId' + '}', order_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body)

  return_type = opts[:return_type]

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:POST, 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: ApprovalsApi#update_order_items_approvals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end