Class: Io::Flow::V0::Models::TierDefault

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Grouping of shipping tiers by experience to provide logical default functionality.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TierDefault

Returns a new instance of TierDefault.



21463
21464
21465
21466
21467
21468
21469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21463

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :default_tier, :experience], 'TierDefault')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @default_tier = (x = opts.delete(:default_tier); x.is_a?(::Io::Flow::V0::Models::TierReference) ? x : ::Io::Flow::V0::Models::TierReference.new(x))
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::FulfillmentExperienceReference) ? x : ::Io::Flow::V0::Models::FulfillmentExperienceReference.new(x))
end

Instance Attribute Details

#default_tier ⇒ Object (readonly)

Returns the value of attribute default_tier.



21461
21462
21463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21461

def default_tier
  @default_tier
end

#experience ⇒ Object (readonly)

Returns the value of attribute experience.



21461
21462
21463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21461

def experience
  @experience
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



21461
21462
21463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21461

def id
  @id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21475
21476
21477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21475

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

#to_hash ⇒ Object



21479
21480
21481
21482
21483
21484
21485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21479

def to_hash
  {
    :id => id,
    :default_tier => default_tier.to_hash,
    :experience => experience.to_hash
  }
end

#to_json ⇒ Object



21471
21472
21473
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21471

def to_json
  JSON.dump(to_hash)
end