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.



56148
56149
56150
56151
56152
56153
56154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56148

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.



56146
56147
56148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56146

def default_duty_display
  @default_duty_display
end

#default_tax_displayObject (readonly)

Returns the value of attribute default_tax_display.



56146
56147
56148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56146

def default_tax_display
  @default_tax_display
end

#editableObject (readonly)

Returns the value of attribute editable.



56146
56147
56148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56146

def editable
  @editable
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56160
56161
56162
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56160

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

#to_hashObject



56164
56165
56166
56167
56168
56169
56170
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56164

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

#to_jsonObject



56156
56157
56158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56156

def to_json
  JSON.dump(to_hash)
end