Class: Io::Flow::V0::Models::OrganizationUpserted

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 = {}) ⇒ OrganizationUpserted

Returns a new instance of OrganizationUpserted.



13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13667

def initialize(incoming={})
  super(:name => Event::Types::ORGANIZATION_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :id, :name, :environment, :currencies], 'OrganizationUpserted')
  @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)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @environment = HttpClient::Preconditions.assert_class('environment', opts.delete(:environment), String)
  @currencies = HttpClient::Preconditions.assert_class('currencies', opts.delete(:currencies), Array).map { |v| HttpClient::Preconditions.assert_class('currencies', v, String) }
  @parent_id = (x = opts.delete(:parent_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('parent_id', x, String))
end

Instance Attribute Details

#currenciesObject (readonly)

Returns the value of attribute currencies.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def currencies
  @currencies
end

#environmentObject (readonly)

Returns the value of attribute environment.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def environment
  @environment
end

#event_idObject (readonly)

Returns the value of attribute event_id.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def parent_id
  @parent_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



13665
13666
13667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13665

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13684
13685
13686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13684

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

#subtype_to_hashObject



13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13688

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :id => id,
    :name => name,
    :environment => environment,
    :currencies => currencies,
    :parent_id => parent_id
  }
end

#to_jsonObject



13680
13681
13682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13680

def to_json
  JSON.dump(to_hash)
end