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.



38801
38802
38803
38804
38805
38806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38801

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.



38799
38800
38801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38799

def datetime
  @datetime
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



38799
38800
38801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38799

def timezone
  @timezone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38812
38813
38814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38812

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

#to_hashObject



38816
38817
38818
38819
38820
38821
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38816

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

#to_jsonObject



38808
38809
38810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38808

def to_json
  JSON.dump(to_hash)
end