Class: XeroRuby::AppStoreApi

Inherits:
Object
  • Object
show all
Defined in:
lib/xero-ruby/api/app_store_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.new) ⇒ AppStoreApi

Returns a new instance of AppStoreApi.



16
17
18
# File 'lib/xero-ruby/api/app_store_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/xero-ruby/api/app_store_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_subscription(subscription_id, opts = {}) ⇒ Subscription

Retrieves a subscription for a given subscriptionId

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

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

    the optional parameters

Returns:

  • (Subscription)


23
24
25
26
# File 'lib/xero-ruby/api/app_store_api.rb', line 23

def get_subscription(subscription_id, opts = {})
  data, _status_code, _headers = get_subscription_with_http_info(subscription_id, opts)
  data
end

#get_subscription_with_http_info(subscription_id, options = {}) ⇒ Array<(Subscription, Integer, Hash)>

Retrieves a subscription for a given subscriptionId

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

  • opts (Hash)

    the optional parameters

Returns:

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

    Subscription data, response status code and response headers



32
33
34
35
36
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
# File 'lib/xero-ruby/api/app_store_api.rb', line 32

def get_subscription_with_http_info(subscription_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AppStoreApi.get_subscription ...'
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling AppStoreApi.get_subscription"
  end
  # resource path
  local_var_path = '/subscriptions/{subscriptionId}'.sub('{' + 'subscriptionId' + '}', subscription_id.to_s)

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].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
  return_type = opts[:return_type] || 'Subscription' 

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

  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, "AppStoreApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppStoreApi#get_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_usage_records(subscription_id, opts = {}) ⇒ UsageRecordsList

Gets all usage records related to the subscription

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

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

    the optional parameters

Returns:

  • (UsageRecordsList)


91
92
93
94
# File 'lib/xero-ruby/api/app_store_api.rb', line 91

def get_usage_records(subscription_id, opts = {})
  data, _status_code, _headers = get_usage_records_with_http_info(subscription_id, opts)
  data
end

#get_usage_records_with_http_info(subscription_id, options = {}) ⇒ Array<(UsageRecordsList, Integer, Hash)>

Gets all usage records related to the subscription

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

  • opts (Hash)

    the optional parameters

Returns:

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

    UsageRecordsList data, response status code and response headers



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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/xero-ruby/api/app_store_api.rb', line 100

def get_usage_records_with_http_info(subscription_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AppStoreApi.get_usage_records ...'
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling AppStoreApi.get_usage_records"
  end
  # resource path
  local_var_path = '/subscriptions/{subscriptionId}/usage-records'.sub('{' + 'subscriptionId' + '}', subscription_id.to_s)

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].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
  return_type = opts[:return_type] || 'UsageRecordsList' 

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

  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, "AppStoreApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppStoreApi#get_usage_records\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_usage_records(subscription_id, subscription_item_id, create_usage_record, opts = {}) ⇒ UsageRecord

Send metered usage belonging to this subscription and subscription item

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

  • subscription_item_id (String)

    The unique identifier of the subscriptionItem

  • create_usage_record (CreateUsageRecord)

    Contains the quantity for the usage record to create

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

    the optional parameters

Returns:

  • (UsageRecord)


161
162
163
164
# File 'lib/xero-ruby/api/app_store_api.rb', line 161

def post_usage_records(subscription_id, subscription_item_id, create_usage_record, opts = {})
  data, _status_code, _headers = post_usage_records_with_http_info(subscription_id, subscription_item_id, create_usage_record, opts)
  data
end

#post_usage_records_with_http_info(subscription_id, subscription_item_id, create_usage_record, options = {}) ⇒ Array<(UsageRecord, Integer, Hash)>

Send metered usage belonging to this subscription and subscription item

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

  • subscription_item_id (String)

    The unique identifier of the subscriptionItem

  • create_usage_record (CreateUsageRecord)

    Contains the quantity for the usage record to create

  • opts (Hash)

    the optional parameters

Returns:

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

    UsageRecord data, response status code and response headers



172
173
174
175
176
177
178
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
229
230
231
232
233
234
235
# File 'lib/xero-ruby/api/app_store_api.rb', line 172

def post_usage_records_with_http_info(subscription_id, subscription_item_id, create_usage_record, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AppStoreApi.post_usage_records ...'
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling AppStoreApi.post_usage_records"
  end
  # verify the required parameter 'subscription_item_id' is set
  if @api_client.config.client_side_validation && subscription_item_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_item_id' when calling AppStoreApi.post_usage_records"
  end
  # verify the required parameter 'create_usage_record' is set
  if @api_client.config.client_side_validation && create_usage_record.nil?
    fail ArgumentError, "Missing the required parameter 'create_usage_record' when calling AppStoreApi.post_usage_records"
  end
  # resource path
  local_var_path = '/subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records'.sub('{' + 'subscriptionId' + '}', subscription_id.to_s).sub('{' + 'subscriptionItemId' + '}', subscription_item_id.to_s)

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

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

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

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

  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, "AppStoreApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppStoreApi#post_usage_records\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_usage_records(subscription_id, subscription_item_id, usage_record_id, update_usage_record, opts = {}) ⇒ UsageRecord

Update and existing metered usage belonging to this subscription and subscription item

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

  • subscription_item_id (String)

    The unique identifier of the subscriptionItem

  • usage_record_id (String)

    The unique identifier of the usage record

  • update_usage_record (UpdateUsageRecord)

    Contains the quantity for the usage record to update

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

    the optional parameters

Returns:

  • (UsageRecord)


244
245
246
247
# File 'lib/xero-ruby/api/app_store_api.rb', line 244

def put_usage_records(subscription_id, subscription_item_id, usage_record_id, update_usage_record, opts = {})
  data, _status_code, _headers = put_usage_records_with_http_info(subscription_id, subscription_item_id, usage_record_id, update_usage_record, opts)
  data
end

#put_usage_records_with_http_info(subscription_id, subscription_item_id, usage_record_id, update_usage_record, options = {}) ⇒ Array<(UsageRecord, Integer, Hash)>

Update and existing metered usage belonging to this subscription and subscription item

Parameters:

  • subscription_id (String)

    Unique identifier for Subscription object

  • subscription_item_id (String)

    The unique identifier of the subscriptionItem

  • usage_record_id (String)

    The unique identifier of the usage record

  • update_usage_record (UpdateUsageRecord)

    Contains the quantity for the usage record to update

  • opts (Hash)

    the optional parameters

Returns:

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

    UsageRecord data, response status code and response headers



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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/xero-ruby/api/app_store_api.rb', line 256

def put_usage_records_with_http_info(subscription_id, subscription_item_id, usage_record_id, update_usage_record, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AppStoreApi.put_usage_records ...'
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling AppStoreApi.put_usage_records"
  end
  # verify the required parameter 'subscription_item_id' is set
  if @api_client.config.client_side_validation && subscription_item_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_item_id' when calling AppStoreApi.put_usage_records"
  end
  # verify the required parameter 'usage_record_id' is set
  if @api_client.config.client_side_validation && usage_record_id.nil?
    fail ArgumentError, "Missing the required parameter 'usage_record_id' when calling AppStoreApi.put_usage_records"
  end
  # verify the required parameter 'update_usage_record' is set
  if @api_client.config.client_side_validation && update_usage_record.nil?
    fail ArgumentError, "Missing the required parameter 'update_usage_record' when calling AppStoreApi.put_usage_records"
  end
  # resource path
  local_var_path = '/subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records/{usageRecordId}'.sub('{' + 'subscriptionId' + '}', subscription_id.to_s).sub('{' + 'subscriptionItemId' + '}', subscription_item_id.to_s).sub('{' + 'usageRecordId' + '}', usage_record_id.to_s)

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

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

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

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

  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, "AppStoreApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AppStoreApi#put_usage_records\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end