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

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationUpserted

Returns a new instance of OrganizationUpserted.



17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17814

def initialize(incoming={})
  super(:discriminator => 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))
  @default_base_currency = (x = opts.delete(:default_base_currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('default_base_currency', x, String))
end

Instance Attribute Details

#currencies ⇒ Object (readonly)

Returns the value of attribute currencies.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def currencies
  @currencies
end

#default_base_currency ⇒ Object (readonly)

Returns the value of attribute default_base_currency.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def default_base_currency
  @default_base_currency
end

#environment ⇒ Object (readonly)

Returns the value of attribute environment.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def environment
  @environment
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def event_id
  @event_id
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def name
  @name
end

#parent_id ⇒ Object (readonly)

Returns the value of attribute parent_id.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def parent_id
  @parent_id
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



17812
17813
17814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17812

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17832
17833
17834
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17832

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

#subtype_to_hash ⇒ Object



17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17836

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

#to_json ⇒ Object



17828
17829
17830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17828

def to_json
  JSON.dump(to_hash)
end