Class: Io::Flow::V0::Models::HopV2

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

Returns a new instance of HopV2.



45070
45071
45072
45073
45074
45075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45070

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:hop_number, :hop_estimate], 'HopV2')
  @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::HopEstimateV2) ? x : ::Io::Flow::V0::Models::HopEstimateV2.new(x))
end

Instance Attribute Details

#hop_estimateObject (readonly)

Returns the value of attribute hop_estimate.



45068
45069
45070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45068

def hop_estimate
  @hop_estimate
end

#hop_numberObject (readonly)

Returns the value of attribute hop_number.



45068
45069
45070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45068

def hop_number
  @hop_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45081
45082
45083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45081

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

#to_hashObject



45085
45086
45087
45088
45089
45090
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45085

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

#to_jsonObject



45077
45078
45079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45077

def to_json
  JSON.dump(to_hash)
end