class Io::Flow::V0::Models::ItemMarginPostForm

A percent and/or fixed margin to apply to items based on query.

Attributes

fixed[R]
key[R]
name[R]
percent[R]
position[R]
q[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47195
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :q], 'ItemMarginPostForm')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @fixed = (x = opts.delete(:fixed); x.nil? ? nil : HttpClient::Preconditions.assert_class('fixed', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @percent = (x = opts.delete(:percent); x.nil? ? nil : HttpClient::Preconditions.assert_class('percent', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47210
def copy(incoming={})
  ItemMarginPostForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47214
def to_hash
  {
    :name => name,
    :q => q,
    :key => key,
    :fixed => fixed.to_f.to_s,
    :percent => percent.to_f.to_s,
    :position => position
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47206
def to_json
  JSON.dump(to_hash)
end