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.



10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10400

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::Address) ? x : ::Io::Flow::V0::Models::Address.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))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def address
  @address
end

#challenge_cipherObject (readonly)

Returns the value of attribute challenge_cipher.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def challenge_cipher
  @challenge_cipher
end

#challenge_textObject (readonly)

Returns the value of attribute challenge_text.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def challenge_text
  @challenge_text
end

#cipherObject (readonly)

Returns the value of attribute cipher.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def cipher
  @cipher
end

#cvvObject (readonly)

Returns the value of attribute cvv.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def cvv
  @cvv
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def expiration_year
  @expiration_year
end

#ipObject (readonly)

Returns the value of attribute ip.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def ip
  @ip
end

#nameObject (readonly)

Returns the value of attribute name.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



10398
10399
10400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10398

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10419
10420
10421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10419

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

#to_hashObject



10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10423

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
  }
end

#to_jsonObject



10415
10416
10417
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10415

def to_json
  JSON.dump(to_hash)
end