Class: Io::Flow::V0::Models::NumberRange

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

Returns a new instance of NumberRange.



44961
44962
44963
44964
44965
44966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44961

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:min, :max], 'NumberRange')
  @min = HttpClient::Preconditions.assert_class('min', opts.delete(:min), Integer)
  @max = HttpClient::Preconditions.assert_class('max', opts.delete(:max), Integer)
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



44959
44960
44961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44959

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



44959
44960
44961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44959

def min
  @min
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44972
44973
44974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44972

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

#to_hashObject



44976
44977
44978
44979
44980
44981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44976

def to_hash
  {
    :min => min,
    :max => max
  }
end

#to_jsonObject



44968
44969
44970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44968

def to_json
  JSON.dump(to_hash)
end