Class: Io::Flow::V0::Models::DeliveryWindowComponent
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryWindowComponent
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryWindowComponent
constructor
A new instance of DeliveryWindowComponent.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryWindowComponent
Returns a new instance of DeliveryWindowComponent.
36103 36104 36105 36106 36107 36108 36109 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36103 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:from, :to, :source], 'DeliveryWindowComponent') @from = HttpClient::Preconditions.assert_class('from', HttpClient::Helper.to_date_time_iso8601(opts.delete(:from)), DateTime) @to = HttpClient::Preconditions.assert_class('to', HttpClient::Helper.to_date_time_iso8601(opts.delete(:to)), DateTime) @source = (x = opts.delete(:source); x.is_a?(::Io::Flow::V0::Models::DeliveryWindowComponentSource) ? x : ::Io::Flow::V0::Models::DeliveryWindowComponentSource.apply(x)) end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
36101 36102 36103 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36101 def from @from end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
36101 36102 36103 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36101 def source @source end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
36101 36102 36103 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36101 def to @to end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36115 36116 36117 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36115 def copy(incoming={}) DeliveryWindowComponent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36119 36120 36121 36122 36123 36124 36125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36119 def to_hash { :from => from, :to => to, :source => source.value } end |
#to_json ⇒ Object
36111 36112 36113 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36111 def to_json JSON.dump(to_hash) end |