class EasyPost::Models::Object

The base class for all JSON objects in the library.

Public Class Methods

new(data) click to toggle source
# File lib/easypost/models/base.rb, line 7
def initialize(data)
  @values = data
  add_properties(data)
end

Public Instance Methods

[](key) click to toggle source

Get element of an array.

# File lib/easypost/models/base.rb, line 23
def [](key)
  @values[key.to_s]
end
[]=(key, value) click to toggle source

Set the element of an array.

# File lib/easypost/models/base.rb, line 28
def []=(key, value)
  send(:"#{key}=", value)
end
to_hash() click to toggle source

Convert object to hash

# File lib/easypost/models/base.rb, line 18
def to_hash
  JSON.parse(JSON.dump(@values))
end
to_s(*_args) click to toggle source

Convert to a string.

# File lib/easypost/models/base.rb, line 13
def to_s(*_args)
  JSON.dump(@values)
end