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.



28767
28768
28769
28770
28771
28772
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28767

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.



28765
28766
28767
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28765

def datetime
  @datetime
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



28765
28766
28767
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28765

def timezone
  @timezone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



28778
28779
28780
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28778

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

#to_hashObject



28782
28783
28784
28785
28786
28787
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28782

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

#to_jsonObject



28774
28775
28776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28774

def to_json
  JSON.dump(to_hash)
end