class Io::Flow::V0::Models::PricingUpserted

Attributes

duty[R]
event_id[R]
experience_key[R]
organization[R]
rounding_method[R]
rounding_type[R]
rounding_value[R]
timestamp[R]
vat[R]

Public Class Methods

new(incoming={}) click to toggle source
Calls superclass method Io::Flow::V0::Models::Event::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 60770
def initialize(incoming={})
  super(:discriminator => Event::Types::PRICING_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :experience_key, :vat, :duty], 'PricingUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @experience_key = HttpClient::Preconditions.assert_class('experience_key', opts.delete(:experience_key), String)
  @vat = HttpClient::Preconditions.assert_class('vat', opts.delete(:vat), String)
  @duty = HttpClient::Preconditions.assert_class('duty', opts.delete(:duty), String)
  @rounding_type = (x = opts.delete(:rounding_type); x.nil? ? nil : HttpClient::Preconditions.assert_class('rounding_type', x, String))
  @rounding_method = (x = opts.delete(:rounding_method); x.nil? ? nil : HttpClient::Preconditions.assert_class('rounding_method', x, String))
  @rounding_value = (x = opts.delete(:rounding_value); x.nil? ? nil : HttpClient::Preconditions.assert_class('rounding_value', HttpClient::Helper.to_big_decimal(x), BigDecimal))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 60789
def copy(incoming={})
  PricingUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 60793
def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :experience_key => experience_key,
    :vat => vat,
    :duty => duty,
    :rounding_type => rounding_type,
    :rounding_method => rounding_method,
    :rounding_value => rounding_value.to_f.to_s
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 60785
def to_json
  JSON.dump(to_hash)
end