Class: Io::Flow::V0::Models::RatecardLaneVersion

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

Returns a new instance of RatecardLaneVersion.



57706
57707
57708
57709
57710
57711
57712
57713
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57706

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :type, :ratecard_lane], 'RatecardLaneVersion')
  @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))
  @ratecard_lane = (x = opts.delete(:ratecard_lane); x.is_a?(::Io::Flow::V0::Models::RatecardLane) ? x : ::Io::Flow::V0::Models::RatecardLane.new(x))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



57704
57705
57706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57704

def id
  @id
end

#ratecard_laneObject (readonly)

Returns the value of attribute ratecard_lane.



57704
57705
57706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57704

def ratecard_lane
  @ratecard_lane
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



57704
57705
57706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57704

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



57704
57705
57706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57704

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



57719
57720
57721
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57719

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

#to_hashObject



57723
57724
57725
57726
57727
57728
57729
57730
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57723

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

#to_jsonObject



57715
57716
57717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57715

def to_json
  JSON.dump(to_hash)
end