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.



8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8037

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:expiration_month, :expiration_year, :name], '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 = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, 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)))
  @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.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def address
  @address
end

#challenge_cipherObject (readonly)

Returns the value of attribute challenge_cipher.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def challenge_cipher
  @challenge_cipher
end

#challenge_textObject (readonly)

Returns the value of attribute challenge_text.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def challenge_text
  @challenge_text
end

#cipherObject (readonly)

Returns the value of attribute cipher.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def cipher
  @cipher
end

#cvvObject (readonly)

Returns the value of attribute cvv.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def cvv
  @cvv
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def expiration_year
  @expiration_year
end

#nameObject (readonly)

Returns the value of attribute name.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



8035
8036
8037
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8035

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



8055
8056
8057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8055

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

#to_hashObject



8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8059

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,
    :challenge_text => challenge_text,
    :challenge_cipher => challenge_cipher
  }
end

#to_jsonObject



8051
8052
8053
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8051

def to_json
  JSON.dump(to_hash)
end