Class: Io::Flow::V0::Models::CardForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CardForm

Returns a new instance of CardForm.



24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24190

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:expiration_month, :expiration_year, :name, :cvv], 'CardForm')
  @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String))
  @cipher = (x = opts.delete(:cipher); x.nil? ? nil : HttpClient::Preconditions.assert_class('cipher', x, String))
  @expiration_month = HttpClient::Preconditions.assert_class('expiration_month', opts.delete(:expiration_month), Integer)
  @expiration_year = HttpClient::Preconditions.assert_class('expiration_year', opts.delete(:expiration_year), Integer)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @cvv = HttpClient::Preconditions.assert_class('cvv', opts.delete(:cvv), String)
  @address = (x = opts.delete(:address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x)))
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
  @challenge_text = (x = opts.delete(:challenge_text); x.nil? ? nil : HttpClient::Preconditions.assert_class('challenge_text', x, String))
  @challenge_cipher = (x = opts.delete(:challenge_cipher); x.nil? ? nil : HttpClient::Preconditions.assert_class('challenge_cipher', x, String))
  @token_type = (x = opts.delete(:token_type); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TokenType) ? x : ::Io::Flow::V0::Models::TokenType.apply(x)))
  @requested_currency = (x = opts.delete(:requested_currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('requested_currency', x, String))
  @metadata = (x = opts.delete(:metadata); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CardMetadata) ? x : ::Io::Flow::V0::Models::CardMetadata.new(x)))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def address
  @address
end

#challenge_cipherObject (readonly)

Returns the value of attribute challenge_cipher.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def challenge_cipher
  @challenge_cipher
end

#challenge_textObject (readonly)

Returns the value of attribute challenge_text.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def challenge_text
  @challenge_text
end

#cipherObject (readonly)

Returns the value of attribute cipher.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def cipher
  @cipher
end

#cvvObject (readonly)

Returns the value of attribute cvv.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def cvv
  @cvv
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def expiration_year
  @expiration_year
end

#ipObject (readonly)

Returns the value of attribute ip.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def ip
  @ip
end

#metadataObject (readonly)

Returns the value of attribute metadata.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def number
  @number
end

#requested_currencyObject (readonly)

Returns the value of attribute requested_currency.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def requested_currency
  @requested_currency
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



24188
24189
24190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24188

def token_type
  @token_type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24212
24213
24214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24212

def copy(incoming={})
  CardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24216

def to_hash
  {
    :number => number,
    :cipher => cipher,
    :expiration_month => expiration_month,
    :expiration_year => expiration_year,
    :name => name,
    :cvv => cvv,
    :address => address.nil? ? nil : address.to_hash,
    :ip => ip,
    :challenge_text => challenge_text,
    :challenge_cipher => challenge_cipher,
    :token_type => token_type.nil? ? nil : token_type.value,
    :requested_currency => requested_currency,
    :metadata => .nil? ? nil : .to_hash
  }
end

#to_jsonObject



24208
24209
24210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24208

def to_json
  JSON.dump(to_hash)
end