Class: Io::Flow::V0::Models::ShippingLaneVersion

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

Returns a new instance of ShippingLaneVersion.



35197
35198
35199
35200
35201
35202
35203
35204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35197

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :type, :shipping_lane], 'ShippingLaneVersion')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ChangeType) ? x : ::Io::Flow::V0::Models::ChangeType.apply(x))
  @shipping_lane = (x = opts.delete(:shipping_lane); x.is_a?(::Io::Flow::V0::Models::ShippingLane) ? x : ::Io::Flow::V0::Models::ShippingLane.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



35195
35196
35197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35195

def id
  @id
end

#shipping_laneObject (readonly)

Returns the value of attribute shipping_lane.



35195
35196
35197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35195

def shipping_lane
  @shipping_lane
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



35195
35196
35197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35195

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



35195
35196
35197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35195

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35210
35211
35212
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35210

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

#to_hashObject



35214
35215
35216
35217
35218
35219
35220
35221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35214

def to_hash
  {
    :id => id,
    :timestamp => timestamp,
    :type => type.value,
    :shipping_lane => shipping_lane.to_hash
  }
end

#to_jsonObject



35206
35207
35208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35206

def to_json
  JSON.dump(to_hash)
end