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.



40082
40083
40084
40085
40086
40087
40088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40082

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.



40080
40081
40082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40080

def default_duty_display
  @default_duty_display
end

#default_tax_displayObject (readonly)

Returns the value of attribute default_tax_display.



40080
40081
40082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40080

def default_tax_display
  @default_tax_display
end

#editableObject (readonly)

Returns the value of attribute editable.



40080
40081
40082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40080

def editable
  @editable
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40094
40095
40096
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40094

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

#to_hashObject



40098
40099
40100
40101
40102
40103
40104
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40098

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

#to_jsonObject



40090
40091
40092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40090

def to_json
  JSON.dump(to_hash)
end