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

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ TierUpserted

Returns a new instance of TierUpserted.



21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21791

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)
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
end

Instance Attribute Details

#description ⇒ Object (readonly)

Returns the value of attribute description.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def description
  @description
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def event_id
  @event_id
end

#experience_key ⇒ Object (readonly)

Returns the value of attribute experience_key.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def experience_key
  @experience_key
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def id
  @id
end

#integration ⇒ Object (readonly)

Returns the value of attribute integration.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def integration
  @integration
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def name
  @name
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def organization
  @organization
end

#rules ⇒ Object (readonly)

Returns the value of attribute rules.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def rules
  @rules
end

#services ⇒ Object (readonly)

Returns the value of attribute services.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def services
  @services
end

#strategy ⇒ Object (readonly)

Returns the value of attribute strategy.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def strategy
  @strategy
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def timestamp
  @timestamp
end

#visibility ⇒ Object (readonly)

Returns the value of attribute visibility.



21789
21790
21791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21789

def visibility
  @visibility
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21813
21814
21815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21813

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

#subtype_to_hash ⇒ Object



21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21817

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,
    :description => description
  }
end

#to_json ⇒ Object



21809
21810
21811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21809

def to_json
  JSON.dump(to_hash)
end