Class: OpenSocial::Group

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

Instance Method Summary collapse

Methods inherited from Base

#add_attr

Constructor Details

#initialize(json) ⇒ Group

Initializes the Group based on the provided json fragment. If no JSON is provided, an empty object (with no attributes) is created.



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/opensocial/group.rb', line 32

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