Class: Jsapi::Model::Base

Inherits:
Object
  • Object
show all
Extended by:
Naming
Includes:
Attributes, Validations
Defined in:
lib/jsapi/model/base.rb

Overview

The base API model used to represent top-level parameters and nested object parameters by default.

Instance Method Summary collapse

Methods included from Naming

model_name

Methods included from Validations

#errors

Methods included from Attributes

#method_missing, #respond_to_missing?

Constructor Details

#initialize(nested) ⇒ Base

Returns a new instance of Base.



13
14
15
# File 'lib/jsapi/model/base.rb', line 13

def initialize(nested)
  @nested = nested
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jsapi::Model::Attributes

Instance Method Details

#==(other) ⇒ Object

:nodoc:



17
18
19
20
21
22
# File 'lib/jsapi/model/base.rb', line 17

def ==(other) # :nodoc:
  super || (
    self.class == other.class &&
    attributes == other.attributes
  )
end

#inspectObject

:nodoc:



24
25
26
27
# File 'lib/jsapi/model/base.rb', line 24

def inspect # :nodoc:
  "#<#{self.class.name} " \
  "#{attributes.map { |k, v| "#{k}: #{v.inspect}" }.join(', ')}>"
end