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

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CardUpserted

Returns a new instance of CardUpserted.



8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8845

def initialize(incoming={})
  super(:name => Event::Types::CARD_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :token, :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)
  @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
  @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String)
  @expiration = HttpClient::Preconditions.assert_class('expiration', HttpClient::Helper.to_object(opts.delete(:expiration)), Hash)
  @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 : HttpClient::Preconditions.assert_class('address', HttpClient::Helper.to_object(x), Hash))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def address
  @address
end

#event_idObject (readonly)

Returns the value of attribute event_id.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def event_id
  @event_id
end

#expirationObject (readonly)

Returns the value of attribute expiration.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def expiration
  @expiration
end

#iinObject (readonly)

Returns the value of attribute iin.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def iin
  @iin
end

#last4Object (readonly)

Returns the value of attribute last4.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def last4
  @last4
end

#nameObject (readonly)

Returns the value of attribute name.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def timestamp
  @timestamp
end

#tokenObject (readonly)

Returns the value of attribute token.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def token
  @token
end

#typeObject (readonly)

Returns the value of attribute type.



8843
8844
8845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8843

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



8865
8866
8867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8865

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

#subtype_to_hashObject



8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8869

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :token => token,
    :type => type,
    :expiration => expiration,
    :iin => iin,
    :last4 => last4,
    :name => name,
    :address => address
  }
end

#to_jsonObject



8861
8862
8863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8861

def to_json
  JSON.dump(to_hash)
end