class Nexmo::Entity

Attributes

attributes[R]

Public Class Methods

new(attributes = nil) click to toggle source
# File lib/nexmo/entity.rb, line 7
def initialize(attributes = nil)
  @attributes = attributes || {}
end

Public Instance Methods

==(entity) click to toggle source
# File lib/nexmo/entity.rb, line 29
def ==(entity)
  entity.class == self.class && entity.attributes == @attributes
end
[](key) click to toggle source
# File lib/nexmo/entity.rb, line 11
def [](key)
  @attributes[attribute_key(key)]
end
[]=(key, value) click to toggle source
# File lib/nexmo/entity.rb, line 15
def []=(key, value)
  @attributes[attribute_key(key)] = value
end
each(&block)
Alias for: each_pair
each_pair(&block) click to toggle source
# File lib/nexmo/entity.rb, line 41
def each_pair(&block)
  return to_enum(:each_pair) unless block

  @attributes.each_pair(&block)
end
Also aliased as: each
method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/nexmo/entity.rb, line 23
def method_missing(name, *args)
  return super unless @attributes.key?(name)

  @attributes[name]
end
respond_to_missing?(name, include_private = false) click to toggle source
Calls superclass method
# File lib/nexmo/entity.rb, line 19
def respond_to_missing?(name, include_private = false)
  @attributes.key?(name) or super
end
to_h() click to toggle source
# File lib/nexmo/entity.rb, line 33
def to_h
  @attributes
end