Class: OpenSocial::AppData

Inherits:
Base
  • Object
show all
Defined in:
lib/opensocial/appdata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_attr

Constructor Details

#initialize(id, json) ⇒ AppData

Initializes the AppData entry based on the provided id and json fragment. If no JSON is provided, an empty object (with only an ID) is created.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/opensocial/appdata.rb', line 34

def initialize(id, json)
  @id = id
  
  if json
    json.each do |key, value|
      begin
        self.send("#{key}=", value)
      rescue NoMethodError
        add_attr(key)
        self.send("#{key}=", value)
      end
    end
  end
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



30
31
32
# File 'lib/opensocial/appdata.rb', line 30

def id
  @id
end