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

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

Instance Attribute Summary collapse

Attributes inherited from CardAuthorizationData

#discriminator

Instance Method Summary collapse

Methods inherited from CardAuthorizationData

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CardForm

Returns a new instance of CardForm.



16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16016

def initialize(incoming={})
  super(:discriminator => CardAuthorizationData::Types::CARD_FORM)
  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))
  @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)))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def address
  @address
end

#challenge_cipherObject (readonly)

Returns the value of attribute challenge_cipher.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def challenge_cipher
  @challenge_cipher
end

#challenge_textObject (readonly)

Returns the value of attribute challenge_text.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def challenge_text
  @challenge_text
end

#cipherObject (readonly)

Returns the value of attribute cipher.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def cipher
  @cipher
end

#cvvObject (readonly)

Returns the value of attribute cvv.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def cvv
  @cvv
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def expiration_year
  @expiration_year
end

#ipObject (readonly)

Returns the value of attribute ip.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def ip
  @ip
end

#nameObject (readonly)

Returns the value of attribute name.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def number
  @number
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



16014
16015
16016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16014

def token_type
  @token_type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16037
16038
16039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16037

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

#subtype_to_hashObject



16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16041

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

#to_jsonObject



16033
16034
16035
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16033

def to_json
  JSON.dump(to_hash)
end