Class: Io::Flow::V0::Models::TierUpserted

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

Returns a new instance of TierUpserted.



39631
39632
39633
39634
39635
39636
39637
39638
39639
39640
39641
39642
39643
39644
39645
39646
39647
39648
39649
39650
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39631

def initialize(incoming={})
  super(:discriminator => Event::Types::TIER_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :id, :experience_key, :integration, :name, :rules, :services, :strategy, :visibility], 'TierUpserted')
  @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)
  @experience_key = HttpClient::Preconditions.assert_class('experience_key', opts.delete(:experience_key), String)
  @integration = HttpClient::Preconditions.assert_class('integration', opts.delete(:integration), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @rules = HttpClient::Preconditions.assert_class('rules', opts.delete(:rules), Array).map { |v| HttpClient::Preconditions.assert_class('rules', HttpClient::Helper.to_object(v), Hash) }
  @services = HttpClient::Preconditions.assert_class('services', opts.delete(:services), Array).map { |v| HttpClient::Preconditions.assert_class('services', HttpClient::Helper.to_object(v), Hash) }
  @strategy = HttpClient::Preconditions.assert_class('strategy', opts.delete(:strategy), String)
  @visibility = HttpClient::Preconditions.assert_class('visibility', opts.delete(:visibility), String)
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
  @direction = (x = opts.delete(:direction); x.nil? ? nil : HttpClient::Preconditions.assert_class('direction', x, String))
  @display = (x = opts.delete(:display); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TierDisplay) ? x : ::Io::Flow::V0::Models::TierDisplay.new(x)))
end

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def description
  @description
end

#directionObject (readonly)

Returns the value of attribute direction.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def direction
  @direction
end

#displayObject (readonly)

Returns the value of attribute display.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def display
  @display
end

#event_idObject (readonly)

Returns the value of attribute event_id.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def event_id
  @event_id
end

#experience_keyObject (readonly)

Returns the value of attribute experience_key.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def experience_key
  @experience_key
end

#idObject (readonly)

Returns the value of attribute id.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def id
  @id
end

#integrationObject (readonly)

Returns the value of attribute integration.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def integration
  @integration
end

#nameObject (readonly)

Returns the value of attribute name.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def organization
  @organization
end

#rulesObject (readonly)

Returns the value of attribute rules.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def rules
  @rules
end

#servicesObject (readonly)

Returns the value of attribute services.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def services
  @services
end

#strategyObject (readonly)

Returns the value of attribute strategy.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def strategy
  @strategy
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def timestamp
  @timestamp
end

#visibilityObject (readonly)

Returns the value of attribute visibility.



39629
39630
39631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39629

def visibility
  @visibility
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39656
39657
39658
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39656

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

#subtype_to_hashObject



39660
39661
39662
39663
39664
39665
39666
39667
39668
39669
39670
39671
39672
39673
39674
39675
39676
39677
39678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39660

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :id => id,
    :experience_key => experience_key,
    :integration => integration,
    :name => name,
    :rules => rules,
    :services => services,
    :strategy => strategy,
    :visibility => visibility,
    :currency => currency,
    :description => description,
    :direction => direction,
    :display => display.nil? ? nil : display.to_hash
  }
end

#to_jsonObject



39652
39653
39654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39652

def to_json
  JSON.dump(to_hash)
end