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.



6652
6653
6654
6655
6656
6657
6658
6659
6660
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6652

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

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



6650
6651
6652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6650

def address
  @address
end

#expiration_monthObject (readonly)

Returns the value of attribute expiration_month.



6650
6651
6652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6650

def expiration_month
  @expiration_month
end

#expiration_yearObject (readonly)

Returns the value of attribute expiration_year.



6650
6651
6652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6650

def expiration_year
  @expiration_year
end

#nameObject (readonly)

Returns the value of attribute name.



6650
6651
6652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6650

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



6650
6651
6652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6650

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



6666
6667
6668
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6666

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

#to_hashObject



6670
6671
6672
6673
6674
6675
6676
6677
6678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6670

def to_hash
  {
    :number => number,
    :expiration_month => expiration_month,
    :expiration_year => expiration_year,
    :name => name,
    :address => address.nil? ? nil : address.to_hash
  }
end

#to_jsonObject



6662
6663
6664
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6662

def to_json
  JSON.dump(to_hash)
end