Class: DeviantArt::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/deviantart/base.rb

Overview

Base of response class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Base

Build response object from JSON data



9
10
11
12
# File 'lib/deviantart/base.rb', line 9

def initialize(attrs)
  @attrs = attrs
  define_hash_attrs(self, @attrs, [])
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



5
6
7
# File 'lib/deviantart/base.rb', line 5

def attrs
  @attrs
end

Class Method Details

.point_to_class(point, klass) ⇒ Object

Set nested point by Array to specified klass.



21
22
23
# File 'lib/deviantart/base.rb', line 21

def point_to_class(point, klass)
  self.points_class_mapping[point] = klass
end

.points_class_mappingObject



15
16
17
# File 'lib/deviantart/base.rb', line 15

def points_class_mapping
  @points_class_mapping ||= {}
end

Instance Method Details

#to_sObject



26
27
28
# File 'lib/deviantart/base.rb', line 26

def to_s
  self.class.name
end