Class: Io::Flow::V0::Models::DatetimeWithTimezone

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

Returns a new instance of DatetimeWithTimezone.



35631
35632
35633
35634
35635
35636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35631

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:datetime, :timezone], 'DatetimeWithTimezone')
  @datetime = HttpClient::Preconditions.assert_class('datetime', HttpClient::Helper.to_date_time_iso8601(opts.delete(:datetime)), DateTime)
  @timezone = HttpClient::Preconditions.assert_class('timezone', opts.delete(:timezone), String)
end

Instance Attribute Details

#datetimeObject (readonly)

Returns the value of attribute datetime.



35629
35630
35631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35629

def datetime
  @datetime
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



35629
35630
35631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35629

def timezone
  @timezone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35642
35643
35644
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35642

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

#to_hashObject



35646
35647
35648
35649
35650
35651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35646

def to_hash
  {
    :datetime => datetime,
    :timezone => timezone
  }
end

#to_jsonObject



35638
35639
35640
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35638

def to_json
  JSON.dump(to_hash)
end