Class: Io::Flow::V0::Models::PricingSettings

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PricingSettings

Returns a new instance of PricingSettings.



60740
60741
60742
60743
60744
60745
60746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60740

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:editable, :default_tax_display, :default_duty_display], 'PricingSettings')
  @editable = HttpClient::Preconditions.assert_boolean('editable', opts.delete(:editable))
  @default_tax_display = (x = opts.delete(:default_tax_display); x.is_a?(::Io::Flow::V0::Models::PricingLevySetting) ? x : ::Io::Flow::V0::Models::PricingLevySetting.apply(x))
  @default_duty_display = (x = opts.delete(:default_duty_display); x.is_a?(::Io::Flow::V0::Models::PricingLevySetting) ? x : ::Io::Flow::V0::Models::PricingLevySetting.apply(x))
end

Instance Attribute Details

#default_duty_displayObject (readonly)

Returns the value of attribute default_duty_display.



60738
60739
60740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60738

def default_duty_display
  @default_duty_display
end

#default_tax_displayObject (readonly)

Returns the value of attribute default_tax_display.



60738
60739
60740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60738

def default_tax_display
  @default_tax_display
end

#editableObject (readonly)

Returns the value of attribute editable.



60738
60739
60740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60738

def editable
  @editable
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



60752
60753
60754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60752

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

#to_hashObject



60756
60757
60758
60759
60760
60761
60762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60756

def to_hash
  {
    :editable => editable,
    :default_tax_display => default_tax_display.value,
    :default_duty_display => default_duty_display.value
  }
end

#to_jsonObject



60748
60749
60750
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 60748

def to_json
  JSON.dump(to_hash)
end