Class: Io::Flow::V0::Models::ShipmentWindow

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

Returns a new instance of ShipmentWindow.



50108
50109
50110
50111
50112
50113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50108

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

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



50106
50107
50108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50106

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



50106
50107
50108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50106

def to
  @to
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50119
50120
50121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50119

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

#to_hashObject



50123
50124
50125
50126
50127
50128
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50123

def to_hash
  {
    :from => from,
    :to => to
  }
end

#to_jsonObject



50115
50116
50117
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50115

def to_json
  JSON.dump(to_hash)
end