Class: Io::Flow::V0::Models::DeliveryOptionUpserted

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 = {}) ⇒ DeliveryOptionUpserted

Returns a new instance of DeliveryOptionUpserted.



26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26085

def initialize(incoming={})
  super(:discriminator => Event::Types::DELIVERY_OPTION_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :id, :cost, :price, :delivered_duty, :service_id, :tier, :window, :rule_outcome, :delivery_window_components], 'DeliveryOptionUpserted')
  @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)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @cost = HttpClient::Preconditions.assert_class('cost', HttpClient::Helper.to_object(opts.delete(:cost)), Hash)
  @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_object(opts.delete(:price)), Hash)
  @delivered_duty = HttpClient::Preconditions.assert_class('delivered_duty', opts.delete(:delivered_duty), String)
  @service_id = HttpClient::Preconditions.assert_class('service_id', opts.delete(:service_id), String)
  @tier = HttpClient::Preconditions.assert_class('tier', HttpClient::Helper.to_object(opts.delete(:tier)), Hash)
  @window = HttpClient::Preconditions.assert_class('window', HttpClient::Helper.to_object(opts.delete(:window)), Hash)
  @rule_outcome = HttpClient::Preconditions.assert_class('rule_outcome', HttpClient::Helper.to_object(opts.delete(:rule_outcome)), Hash)
  @weight = (x = opts.delete(:weight); x.nil? ? nil : HttpClient::Preconditions.assert_class('weight', HttpClient::Helper.to_object(x), Hash))
  @delivery_window_components = HttpClient::Preconditions.assert_class('delivery_window_components', HttpClient::Helper.to_object(opts.delete(:delivery_window_components)), Hash)
  @surcharge = (x = opts.delete(:surcharge); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceWithBaseAndDetails) ? x : ::Io::Flow::V0::Models::PriceWithBaseAndDetails.new(x)))
end

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def cost
  @cost
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def delivered_duty
  @delivered_duty
end

#delivery_window_componentsObject (readonly)

Returns the value of attribute delivery_window_components.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def delivery_window_components
  @delivery_window_components
end

#event_idObject (readonly)

Returns the value of attribute event_id.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def id
  @id
end

#organizationObject (readonly)

Returns the value of attribute organization.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def organization
  @organization
end

#priceObject (readonly)

Returns the value of attribute price.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def price
  @price
end

#rule_outcomeObject (readonly)

Returns the value of attribute rule_outcome.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def rule_outcome
  @rule_outcome
end

#service_idObject (readonly)

Returns the value of attribute service_id.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def service_id
  @service_id
end

#surchargeObject (readonly)

Returns the value of attribute surcharge.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def surcharge
  @surcharge
end

#tierObject (readonly)

Returns the value of attribute tier.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def tier
  @tier
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def timestamp
  @timestamp
end

#weightObject (readonly)

Returns the value of attribute weight.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def weight
  @weight
end

#windowObject (readonly)

Returns the value of attribute window.



26083
26084
26085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26083

def window
  @window
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26109
26110
26111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26109

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

#subtype_to_hashObject



26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26113

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :id => id,
    :cost => cost,
    :price => price,
    :delivered_duty => delivered_duty,
    :service_id => service_id,
    :tier => tier,
    :window => window,
    :rule_outcome => rule_outcome,
    :weight => weight,
    :delivery_window_components => delivery_window_components,
    :surcharge => surcharge.nil? ? nil : surcharge.to_hash
  }
end

#to_jsonObject



26105
26106
26107
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26105

def to_json
  JSON.dump(to_hash)
end