Class: Io::Flow::V0::Models::CardUpserted

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

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CardUpserted

Returns a new instance of CardUpserted.



15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15604

def initialize(incoming={})
  super(:discriminator => Event::Types::CARD_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :id, :type, :expiration, :iin, :last4, :name], 'CardUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String)
  @expiration = (x = opts.delete(:expiration); x.is_a?(::Io::Flow::V0::Models::Expiration) ? x : ::Io::Flow::V0::Models::Expiration.new(x))
  @iin = HttpClient::Preconditions.assert_class('iin', opts.delete(:iin), String)
  @last4 = HttpClient::Preconditions.assert_class('last4', opts.delete(:last4), String)
  @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.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def address
  @address
end

#event_idObject (readonly)

Returns the value of attribute event_id.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def event_id
  @event_id
end

#expirationObject (readonly)

Returns the value of attribute expiration.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def expiration
  @expiration
end

#idObject (readonly)

Returns the value of attribute id.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def id
  @id
end

#iinObject (readonly)

Returns the value of attribute iin.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def iin
  @iin
end

#last4Object (readonly)

Returns the value of attribute last4.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def last4
  @last4
end

#nameObject (readonly)

Returns the value of attribute name.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



15602
15603
15604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15602

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15624
15625
15626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15624

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

#subtype_to_hashObject



15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15628

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :id => id,
    :type => type,
    :expiration => expiration.to_hash,
    :iin => iin,
    :last4 => last4,
    :name => name,
    :address => address.nil? ? nil : address.to_hash
  }
end

#to_jsonObject



15620
15621
15622
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15620

def to_json
  JSON.dump(to_hash)
end