Class: Lessonly::Group

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/lessonly/group.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Group



19
20
21
22
23
24
# File 'lib/lessonly/group.rb', line 19

def initialize(response)
  @id = response["id"]
  @name = response["name"]
  @members = response["members"]
  @managers = response["managers"]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/lessonly/group.rb', line 17

def id
  @id
end

#managersObject (readonly)

Returns the value of attribute managers.



17
18
19
# File 'lib/lessonly/group.rb', line 17

def managers
  @managers
end

#membersObject (readonly)

Returns the value of attribute members.



17
18
19
# File 'lib/lessonly/group.rb', line 17

def members
  @members
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/lessonly/group.rb', line 17

def name
  @name
end

Class Method Details

.allObject



12
13
14
15
# File 'lib/lessonly/group.rb', line 12

def self.all
  users_data = get("/groups").parsed_response
  users_data["groups"].map { |data| new(data) }
end

.find(id) ⇒ Object



7
8
9
10
# File 'lib/lessonly/group.rb', line 7

def self.find(id)
  user_data = get("/groups/#{id}").parsed_response
  new(user_data)
end