Class: Io::Flow::V0::Models::OptionWeightEstimates

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

Returns a new instance of OptionWeightEstimates.



51155
51156
51157
51158
51159
51160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51155

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:gravitational, :dimensional], 'OptionWeightEstimates')
  @gravitational = (x = opts.delete(:gravitational); x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x))
  @dimensional = (x = opts.delete(:dimensional); x.is_a?(::Io::Flow::V0::Models::Measurement) ? x : ::Io::Flow::V0::Models::Measurement.new(x))
end

Instance Attribute Details

#dimensionalObject (readonly)

Returns the value of attribute dimensional.



51153
51154
51155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51153

def dimensional
  @dimensional
end

#gravitationalObject (readonly)

Returns the value of attribute gravitational.



51153
51154
51155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51153

def gravitational
  @gravitational
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51166
51167
51168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51166

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

#to_hashObject



51170
51171
51172
51173
51174
51175
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51170

def to_hash
  {
    :gravitational => gravitational.to_hash,
    :dimensional => dimensional.to_hash
  }
end

#to_jsonObject



51162
51163
51164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51162

def to_json
  JSON.dump(to_hash)
end