Class: Io::Flow::V0::Models::Hop

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

Returns a new instance of Hop.



39891
39892
39893
39894
39895
39896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39891

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:hop_number, :hop_estimate], 'Hop')
  @hop_number = HttpClient::Preconditions.assert_class('hop_number', opts.delete(:hop_number), Integer)
  @hop_estimate = (x = opts.delete(:hop_estimate); x.is_a?(::Io::Flow::V0::Models::HopEstimate) ? x : ::Io::Flow::V0::Models::HopEstimate.new(x))
end

Instance Attribute Details

#hop_estimateObject (readonly)

Returns the value of attribute hop_estimate.



39889
39890
39891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39889

def hop_estimate
  @hop_estimate
end

#hop_numberObject (readonly)

Returns the value of attribute hop_number.



39889
39890
39891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39889

def hop_number
  @hop_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39902
39903
39904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39902

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

#to_hashObject



39906
39907
39908
39909
39910
39911
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39906

def to_hash
  {
    :hop_number => hop_number,
    :hop_estimate => hop_estimate.to_hash
  }
end

#to_jsonObject



39898
39899
39900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39898

def to_json
  JSON.dump(to_hash)
end