Class: Checkbook::Vcc

Inherits:
Object
  • Object
show all
Defined in:
lib/checkbook/api/vcc.rb,
lib/checkbook/models/vcc.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Vcc

Initializes the object

Parameters:

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

    Model attributes in the form of hash



94
95
96
# File 'lib/checkbook/models/vcc.rb', line 94

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

Instance Attribute Details

#addressObject

Returns the value of attribute address.



18
19
20
# File 'lib/checkbook/models/vcc.rb', line 18

def address
  @address
end

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/checkbook/api/vcc.rb', line 17

def api_client
  @api_client
end

#balanceObject

VCC balance



21
22
23
# File 'lib/checkbook/models/vcc.rb', line 21

def balance
  @balance
end

#card_numberObject

Last 4 of VCC number



24
25
26
# File 'lib/checkbook/models/vcc.rb', line 24

def card_number
  @card_number
end

#dateObject

VCC creation timestamp



27
28
29
# File 'lib/checkbook/models/vcc.rb', line 27

def date
  @date
end

#defaultObject

Indicates the default VCC account for the user



30
31
32
# File 'lib/checkbook/models/vcc.rb', line 30

def default
  @default
end

#expiration_dateObject

VCC expiration date



33
34
35
# File 'lib/checkbook/models/vcc.rb', line 33

def expiration_date
  @expiration_date
end

#idObject

Unique identifier for VCC



36
37
38
# File 'lib/checkbook/models/vcc.rb', line 36

def id
  @id
end

#nameObject

Name of the VCC



39
40
41
# File 'lib/checkbook/models/vcc.rb', line 39

def name
  @name
end

#ruleset_prefixObject

VCC ruleset prefix



42
43
44
# File 'lib/checkbook/models/vcc.rb', line 42

def ruleset_prefix
  @ruleset_prefix
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/checkbook/models/vcc.rb', line 317

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = ::Checkbook.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



60
61
62
# File 'lib/checkbook/models/vcc.rb', line 60

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



65
66
67
# File 'lib/checkbook/models/vcc.rb', line 65

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/checkbook/models/vcc.rb', line 45

def self.attribute_map
  {
    :'address' => :'address',
    :'balance' => :'balance',
    :'card_number' => :'card_number',
    :'date' => :'date',
    :'default' => :'default',
    :'expiration_date' => :'expiration_date',
    :'id' => :'id',
    :'name' => :'name',
    :'ruleset_prefix' => :'ruleset_prefix'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/checkbook/models/vcc.rb', line 293

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



85
86
87
88
89
90
# File 'lib/checkbook/models/vcc.rb', line 85

def self.openapi_nullable
  Set.new([
    :'name',
    :'ruleset_prefix'
  ])
end

.openapi_typesObject

Attribute type mapping.



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/checkbook/models/vcc.rb', line 70

def self.openapi_types
  {
    :'address' => :'VccAddress',
    :'balance' => :'String',
    :'card_number' => :'String',
    :'date' => :'String',
    :'default' => :'Boolean',
    :'expiration_date' => :'String',
    :'id' => :'String',
    :'name' => :'String',
    :'ruleset_prefix' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/checkbook/models/vcc.rb', line 264

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address == o.address &&
      balance == o.balance &&
      card_number == o.card_number &&
      date == o.date &&
      default == o.default &&
      expiration_date == o.expiration_date &&
      id == o.id &&
      name == o.name &&
      ruleset_prefix == o.ruleset_prefix
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/checkbook/models/vcc.rb', line 388

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#delete_vcc(vcc_id, opts = {}) ⇒ nil

Remove virtual card Remove the specified vcc

Parameters:

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/checkbook/api/vcc.rb', line 27

def delete_vcc(vcc_id, opts = {})
  delete_vcc_with_http_info(vcc_id, opts)
  nil
end

#delete_vcc_with_http_info(vcc_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove virtual card Remove the specified vcc

Parameters:

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

    the optional parameters

Returns:

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

    nil, 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
# File 'lib/checkbook/api/vcc.rb', line 37

def delete_vcc_with_http_info(vcc_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Vcc.delete_vcc ...'
  end
  # verify the required parameter 'vcc_id' is set
  if @api_client.config.client_side_validation && vcc_id.nil?
    fail ArgumentError, "Missing the required parameter 'vcc_id' when calling Vcc.delete_vcc"
  end
  # resource path
  local_var_path = '/v3/account/vcc/{vcc_id}'.sub('{' + 'vcc_id' + '}', CGI.escape(vcc_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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Vcc.delete_vcc",
    :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: Vcc#delete_vcc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


280
281
282
# File 'lib/checkbook/models/vcc.rb', line 280

def eql?(o)
  self == o
end

#get_vcc_transaction(vcc_id, opts = {}) ⇒ VccTransactionsResponse

Get virtual card transactions Get the transactions for the specified VCC

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :beta (Boolean) — default: default to false
  • :end_date (Date)

    End date

  • :page (Integer)

    Page number (default to 1)

  • :per_page (Integer)

    Items per page (default to 50)

  • :start_date (Date)

    Start date

Returns:



95
96
97
98
# File 'lib/checkbook/api/vcc.rb', line 95

def get_vcc_transaction(vcc_id, opts = {})
  data, _status_code, _headers = get_vcc_transaction_with_http_info(vcc_id, opts)
  data
end

#get_vcc_transaction_by_id(vcc_id, transaction_id, opts = {}) ⇒ VccTransaction

Get virtual card transaction by ID Get the requested transaction for the specified VCC

Parameters:

  • vcc_id (String)
  • transaction_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



177
178
179
180
# File 'lib/checkbook/api/vcc.rb', line 177

def get_vcc_transaction_by_id(vcc_id, transaction_id, opts = {})
  data, _status_code, _headers = get_vcc_transaction_by_id_with_http_info(vcc_id, transaction_id, opts)
  data
end

#get_vcc_transaction_by_id_with_http_info(vcc_id, transaction_id, opts = {}) ⇒ Array<(VccTransaction, Integer, Hash)>

Get virtual card transaction by ID Get the requested transaction for the specified VCC

Parameters:

  • vcc_id (String)
  • transaction_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    VccTransaction data, response status code and response headers



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
236
237
238
# File 'lib/checkbook/api/vcc.rb', line 188

def get_vcc_transaction_by_id_with_http_info(vcc_id, transaction_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Vcc.get_vcc_transaction_by_id ...'
  end
  # verify the required parameter 'vcc_id' is set
  if @api_client.config.client_side_validation && vcc_id.nil?
    fail ArgumentError, "Missing the required parameter 'vcc_id' when calling Vcc.get_vcc_transaction_by_id"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling Vcc.get_vcc_transaction_by_id"
  end
  # resource path
  local_var_path = '/v3/account/vcc/{vcc_id}/transaction/{transaction_id}'.sub('{' + 'vcc_id' + '}', CGI.escape(vcc_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'VccTransaction'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Vcc.get_vcc_transaction_by_id",
    :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: Vcc#get_vcc_transaction_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_vcc_transaction_with_http_info(vcc_id, opts = {}) ⇒ Array<(VccTransactionsResponse, Integer, Hash)>

Get virtual card transactions Get the transactions for the specified VCC

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :beta (Boolean) — default: default to false
  • :end_date (Date)

    End date

  • :page (Integer)

    Page number (default to 1)

  • :per_page (Integer)

    Items per page (default to 50)

  • :start_date (Date)

    Start date

Returns:

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

    VccTransactionsResponse data, response status code and response headers



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
163
164
165
166
167
168
169
# File 'lib/checkbook/api/vcc.rb', line 110

def get_vcc_transaction_with_http_info(vcc_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Vcc.get_vcc_transaction ...'
  end
  # verify the required parameter 'vcc_id' is set
  if @api_client.config.client_side_validation && vcc_id.nil?
    fail ArgumentError, "Missing the required parameter 'vcc_id' when calling Vcc.get_vcc_transaction"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling Vcc.get_vcc_transaction, must be greater than or equal to 1.'
  end

  allowable_values = [10, 25, 50]
  if @api_client.config.client_side_validation && opts[:'per_page'] && !allowable_values.include?(opts[:'per_page'])
    fail ArgumentError, "invalid value for \"per_page\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v3/account/vcc/{vcc_id}/transaction'.sub('{' + 'vcc_id' + '}', CGI.escape(vcc_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'beta'] = opts[:'beta'] if !opts[:'beta'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'VccTransactionsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Vcc.get_vcc_transaction",
    :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: Vcc#get_vcc_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_vccs(opts = {}) ⇒ VccQueryResponse

Get virtual cards Return the virtual cards

Parameters:

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

    the optional parameters

Returns:



244
245
246
247
# File 'lib/checkbook/api/vcc.rb', line 244

def get_vccs(opts = {})
  data, _status_code, _headers = get_vccs_with_http_info(opts)
  data
end

#get_vccs_with_http_info(opts = {}) ⇒ Array<(VccQueryResponse, Integer, Hash)>

Get virtual cards Return the virtual cards

Parameters:

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

    the optional parameters

Returns:

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

    VccQueryResponse data, response status code and response headers



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
# File 'lib/checkbook/api/vcc.rb', line 253

def get_vccs_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Vcc.get_vccs ...'
  end
  # resource path
  local_var_path = '/v3/account/vcc'

  # 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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'VccQueryResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Vcc.get_vccs",
    :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: Vcc#get_vccs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



286
287
288
# File 'lib/checkbook/models/vcc.rb', line 286

def hash
  [address, balance, card_number, date, default, expiration_date, id, name, ruleset_prefix].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/checkbook/models/vcc.rb', line 159

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @balance.nil?
    invalid_properties.push('invalid value for "balance", balance cannot be nil.')
  end

  if @card_number.nil?
    invalid_properties.push('invalid value for "card_number", card_number cannot be nil.')
  end

  if @date.nil?
    invalid_properties.push('invalid value for "date", date cannot be nil.')
  end

  if @default.nil?
    invalid_properties.push('invalid value for "default", default cannot be nil.')
  end

  if @expiration_date.nil?
    invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.')
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  invalid_properties
end

#post_vcc(create_vcc_request, opts = {}) ⇒ CreateVccResponse

Create virtual card Add a new vcc

Parameters:

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

    the optional parameters

Returns:



302
303
304
305
# File 'lib/checkbook/api/vcc.rb', line 302

def post_vcc(create_vcc_request, opts = {})
  data, _status_code, _headers = post_vcc_with_http_info(create_vcc_request, opts)
  data
end

#post_vcc_with_http_info(create_vcc_request, opts = {}) ⇒ Array<(CreateVccResponse, Integer, Hash)>

Create virtual card Add a new vcc

Parameters:

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

    the optional parameters

Returns:

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

    CreateVccResponse data, response status code and response headers



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/checkbook/api/vcc.rb', line 312

def post_vcc_with_http_info(create_vcc_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Vcc.post_vcc ...'
  end
  # verify the required parameter 'create_vcc_request' is set
  if @api_client.config.client_side_validation && create_vcc_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_vcc_request' when calling Vcc.post_vcc"
  end
  # resource path
  local_var_path = '/v3/account/vcc'

  # 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'CreateVccResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Vcc.post_vcc",
    :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: Vcc#post_vcc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_vcc(vcc_id, update_vcc_request, opts = {}) ⇒ nil

Update virtual card Update the specified vcc

Parameters:

  • vcc_id (String)
  • update_vcc_request (UpdateVccRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


371
372
373
374
# File 'lib/checkbook/api/vcc.rb', line 371

def put_vcc(vcc_id, update_vcc_request, opts = {})
  put_vcc_with_http_info(vcc_id, update_vcc_request, opts)
  nil
end

#put_vcc_with_http_info(vcc_id, update_vcc_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update virtual card Update the specified vcc

Parameters:

  • vcc_id (String)
  • update_vcc_request (UpdateVccRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/checkbook/api/vcc.rb', line 382

def put_vcc_with_http_info(vcc_id, update_vcc_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Vcc.put_vcc ...'
  end
  # verify the required parameter 'vcc_id' is set
  if @api_client.config.client_side_validation && vcc_id.nil?
    fail ArgumentError, "Missing the required parameter 'vcc_id' when calling Vcc.put_vcc"
  end
  # verify the required parameter 'update_vcc_request' is set
  if @api_client.config.client_side_validation && update_vcc_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_vcc_request' when calling Vcc.put_vcc"
  end
  # resource path
  local_var_path = '/v3/account/vcc/{vcc_id}'.sub('{' + 'vcc_id' + '}', CGI.escape(vcc_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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Vcc.put_vcc",
    :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: Vcc#put_vcc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



364
365
366
# File 'lib/checkbook/models/vcc.rb', line 364

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/checkbook/models/vcc.rb', line 370

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



358
359
360
# File 'lib/checkbook/models/vcc.rb', line 358

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



191
192
193
194
195
196
197
198
199
200
# File 'lib/checkbook/models/vcc.rb', line 191

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @balance.nil?
  return false if @card_number.nil?
  return false if @date.nil?
  return false if @default.nil?
  return false if @expiration_date.nil?
  return false if @id.nil?
  true
end