class EasyPost::Models::Object
The base class for all JSON objects in the library.
Public Class Methods
Source
# File lib/easypost/models/base.rb, line 7 def initialize(data) @values = data add_properties(data) end
Public Instance Methods
Source
# File lib/easypost/models/base.rb, line 23 def [](key) @values[key.to_s] end
Get element of an array.
Source
# File lib/easypost/models/base.rb, line 28 def []=(key, value) send(:"#{key}=", value) end
Set the element of an array.
Source
# File lib/easypost/models/base.rb, line 18 def to_hash JSON.parse(JSON.dump(@values)) end
Convert object to hash
Source
# File lib/easypost/models/base.rb, line 13 def to_s(*_args) JSON.dump(@values) end
Convert to a string.