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.



31977
31978
31979
31980
31981
31982
31983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31977

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_tierObject (readonly)

Returns the value of attribute default_tier.



31975
31976
31977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31975

def default_tier
  @default_tier
end

#experienceObject (readonly)

Returns the value of attribute experience.



31975
31976
31977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31975

def experience
  @experience
end

#idObject (readonly)

Returns the value of attribute id.



31975
31976
31977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31975

def id
  @id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31989
31990
31991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31989

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

#to_hashObject



31993
31994
31995
31996
31997
31998
31999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31993

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

#to_jsonObject



31985
31986
31987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31985

def to_json
  JSON.dump(to_hash)
end