Class: Everybit::EverybitObject

Inherits:
Object
  • Object
show all
Defined in:
lib/everybit/everybit_object.rb

Direct Known Subclasses

Resource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, status, data) ⇒ EverybitObject

Returns a new instance of EverybitObject.



6
7
8
9
10
# File 'lib/everybit/everybit_object.rb', line 6

def initialize(code, status, data)
  @code   = code
  @status = status
  @data   = data
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/everybit/everybit_object.rb', line 4

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/everybit/everybit_object.rb', line 4

def status
  @status
end

Instance Method Details

#[](k) ⇒ Object



12
13
14
# File 'lib/everybit/everybit_object.rb', line 12

def [](k)
  @data[k]
end

#[]=(k, v) ⇒ Object



16
17
18
# File 'lib/everybit/everybit_object.rb', line 16

def []=(k, v)
  @data[k] = v
end

#inspectObject



28
29
30
# File 'lib/everybit/everybit_object.rb', line 28

def inspect()
  "#<#{self.class}:#{@data[:uuid]}> JSON: #{@data}"
end

#to_json(*a) ⇒ Object



24
25
26
# File 'lib/everybit/everybit_object.rb', line 24

def to_json(*a)
  @data
end

#to_sObject



20
21
22
# File 'lib/everybit/everybit_object.rb', line 20

def to_s
  MultiJson.dump(@data)
end