Class: Yapstone::MarketplacesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/yapstone-so/api/marketplaces_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MarketplacesApi

Returns a new instance of MarketplacesApi.



19
20
21
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_marketplace_product(contract_id, marketplace_product_add, opts = {}) ⇒ MarketplaceProductResource

Add a new market place in a given contract.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • marketplace_product_add (MarketplaceProductAdd)

    The market place details

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 27

def add_marketplace_product(contract_id, marketplace_product_add, opts = {})
  data, _status_code, _headers = add_marketplace_product_with_http_info(contract_id, marketplace_product_add, opts)
  data
end

#add_marketplace_product_with_http_info(contract_id, marketplace_product_add, opts = {}) ⇒ Array<(MarketplaceProductResource, Integer, Hash)>

Add a new market place in a given contract.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • marketplace_product_add (MarketplaceProductAdd)

    The market place details

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

    the optional parameters

Returns:

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

    MarketplaceProductResource data, response status code and response headers



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
80
81
82
83
84
85
86
87
88
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 37

def add_marketplace_product_with_http_info(contract_id, marketplace_product_add, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketplacesApi.add_marketplace_product ...'
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling MarketplacesApi.add_marketplace_product"
  end
  # verify the required parameter 'marketplace_product_add' is set
  if @api_client.config.client_side_validation && marketplace_product_add.nil?
    fail ArgumentError, "Missing the required parameter 'marketplace_product_add' when calling MarketplacesApi.add_marketplace_product"
  end
  # resource path
  local_var_path = '/contracts/{contractId}/marketplaces'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/'))

  # 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(marketplace_product_add) 

  # return_type
  return_type = opts[:return_type] || 'MarketplaceProductResource' 

  # auth_names
  auth_names = opts[:auth_names] || ['Bearer']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketplacesApi#add_marketplace_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#deactivate_marketplace_product(contract_id, asset_id, deactivate_request, opts = {}) ⇒ nil

deactivate the Marketplace Product Resource.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • asset_id (String)

    The unique id of the Asset Resource.

  • deactivate_request (DeactivateRequest)

    The details of the deactivation process.

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

    the optional parameters

Returns:

  • (nil)


96
97
98
99
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 96

def deactivate_marketplace_product(contract_id, asset_id, deactivate_request, opts = {})
  deactivate_marketplace_product_with_http_info(contract_id, asset_id, deactivate_request, opts)
  nil
end

#deactivate_marketplace_product_with_http_info(contract_id, asset_id, deactivate_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

deactivate the Marketplace Product Resource.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • asset_id (String)

    The unique id of the Asset Resource.

  • deactivate_request (DeactivateRequest)

    The details of the deactivation process.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 107

def deactivate_marketplace_product_with_http_info(contract_id, asset_id, deactivate_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketplacesApi.deactivate_marketplace_product ...'
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling MarketplacesApi.deactivate_marketplace_product"
  end
  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling MarketplacesApi.deactivate_marketplace_product"
  end
  # verify the required parameter 'deactivate_request' is set
  if @api_client.config.client_side_validation && deactivate_request.nil?
    fail ArgumentError, "Missing the required parameter 'deactivate_request' when calling MarketplacesApi.deactivate_marketplace_product"
  end
  # resource path
  local_var_path = '/contracts/{contractId}/marketplaces/{assetId}'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/')).sub('{' + 'assetId' + '}', CGI.escape(asset_id.to_s).gsub('%2F', '/'))

  # 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(deactivate_request) 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['Bearer']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketplacesApi#deactivate_marketplace_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_marketplace_product_by_asset_id(contract_id, asset_id, opts = {}) ⇒ MarketplaceProductResource

Retrieves an Marketplace Resource from the system for the given contractId and assetId.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • asset_id (String)

    The unique id of the Asset Resource.

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

    the optional parameters

Returns:



169
170
171
172
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 169

def get_marketplace_product_by_asset_id(contract_id, asset_id, opts = {})
  data, _status_code, _headers = get_marketplace_product_by_asset_id_with_http_info(contract_id, asset_id, opts)
  data
end

#get_marketplace_product_by_asset_id_with_http_info(contract_id, asset_id, opts = {}) ⇒ Array<(MarketplaceProductResource, Integer, Hash)>

Retrieves an Marketplace Resource from the system for the given contractId and assetId.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • asset_id (String)

    The unique id of the Asset Resource.

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

    the optional parameters

Returns:

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

    MarketplaceProductResource data, response status code and response headers



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 179

def get_marketplace_product_by_asset_id_with_http_info(contract_id, asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketplacesApi.get_marketplace_product_by_asset_id ...'
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling MarketplacesApi.get_marketplace_product_by_asset_id"
  end
  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling MarketplacesApi.get_marketplace_product_by_asset_id"
  end
  # resource path
  local_var_path = '/contracts/{contractId}/marketplaces/{assetId}'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/')).sub('{' + 'assetId' + '}', CGI.escape(asset_id.to_s).gsub('%2F', '/'))

  # 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'])

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

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

  # return_type
  return_type = opts[:return_type] || 'MarketplaceProductResource' 

  # auth_names
  auth_names = opts[:auth_names] || ['Bearer']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketplacesApi#get_marketplace_product_by_asset_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_marketplace_product_by_contract_id(contract_id, asset_id, marketplace_product_update, opts = {}) ⇒ MarketplaceProductResource

Updates the Marketplace Resource in a given Contract Resource.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • asset_id (String)

    The unique id of the Asset Resource.

  • marketplace_product_update (MarketplaceProductUpdate)

    The Market Resource to be updated.

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

    the optional parameters

Returns:



236
237
238
239
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 236

def update_marketplace_product_by_contract_id(contract_id, asset_id, marketplace_product_update, opts = {})
  data, _status_code, _headers = update_marketplace_product_by_contract_id_with_http_info(contract_id, asset_id, marketplace_product_update, opts)
  data
end

#update_marketplace_product_by_contract_id_with_http_info(contract_id, asset_id, marketplace_product_update, opts = {}) ⇒ Array<(MarketplaceProductResource, Integer, Hash)>

Updates the Marketplace Resource in a given Contract Resource.

Parameters:

  • contract_id (String)

    The unique id of the Contract Resource.

  • asset_id (String)

    The unique id of the Asset Resource.

  • marketplace_product_update (MarketplaceProductUpdate)

    The Market Resource to be updated.

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

    the optional parameters

Returns:

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

    MarketplaceProductResource data, response status code and response headers



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/yapstone-so/api/marketplaces_api.rb', line 247

def update_marketplace_product_by_contract_id_with_http_info(contract_id, asset_id, marketplace_product_update, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketplacesApi.update_marketplace_product_by_contract_id ...'
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling MarketplacesApi.update_marketplace_product_by_contract_id"
  end
  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling MarketplacesApi.update_marketplace_product_by_contract_id"
  end
  # verify the required parameter 'marketplace_product_update' is set
  if @api_client.config.client_side_validation && marketplace_product_update.nil?
    fail ArgumentError, "Missing the required parameter 'marketplace_product_update' when calling MarketplacesApi.update_marketplace_product_by_contract_id"
  end
  # resource path
  local_var_path = '/contracts/{contractId}/marketplaces/{assetId}'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/')).sub('{' + 'assetId' + '}', CGI.escape(asset_id.to_s).gsub('%2F', '/'))

  # 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-patch+json'])

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

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

  # return_type
  return_type = opts[:return_type] || 'MarketplaceProductResource' 

  # auth_names
  auth_names = opts[:auth_names] || ['Bearer']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketplacesApi#update_marketplace_product_by_contract_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end