Class: Io::Flow::V0::Models::PricingUpserted

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

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PricingUpserted

Returns a new instance of PricingUpserted.



24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24209

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

Instance Attribute Details

#dutyObject (readonly)

Returns the value of attribute duty.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def duty
  @duty
end

#event_idObject (readonly)

Returns the value of attribute event_id.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def event_id
  @event_id
end

#experience_keyObject (readonly)

Returns the value of attribute experience_key.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def experience_key
  @experience_key
end

#organizationObject (readonly)

Returns the value of attribute organization.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def organization
  @organization
end

#rounding_methodObject (readonly)

Returns the value of attribute rounding_method.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def rounding_method
  @rounding_method
end

#rounding_typeObject (readonly)

Returns the value of attribute rounding_type.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def rounding_type
  @rounding_type
end

#rounding_valueObject (readonly)

Returns the value of attribute rounding_value.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def rounding_value
  @rounding_value
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def timestamp
  @timestamp
end

#vatObject (readonly)

Returns the value of attribute vat.



24207
24208
24209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24207

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24228
24229
24230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24228

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

#subtype_to_hashObject



24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24232

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
  }
end

#to_jsonObject



24224
24225
24226
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24224

def to_json
  JSON.dump(to_hash)
end