Module: TheCity::API::Groups

Includes:
Utils
Included in:
Client
Defined in:
lib/the_city/api/groups.rb

Instance Method Summary collapse

Instance Method Details

#group(id) ⇒ TheCity::Group #group(id, options = {}) ⇒ TheCity::Group

Returns a group by id

Overloads:

  • #group(id) ⇒ TheCity::Group

    Parameters:

    • id (Integer)

      The id of the group.

  • #group(id, options = {}) ⇒ TheCity::Group

    Parameters:

    • id (Integer)

      The id of the group.

    • options (Hash) (defaults to: {})

      A customizable set of options.

    Options Hash (options):

    • :force_download (Boolean)

      Forces the request to hit the server and flush the cached response

Returns:

Raises:



31
32
33
34
35
36
37
# File 'lib/the_city/api/groups.rb', line 31

def group(*args)
  @groups ||= {}
  arguments = TheCity::Arguments.new(args)
  gid = args.shift
  @groups[tid] = nil if arguments.options.delete(:force_download)
  @groups[tid] ||= object_from_response(TheCity::Group, :get, "/groups/#{gid}", arguments.options)
end

#my_groups(options = {}) ⇒ Array<TheCity::Group>

Returns all the groups that the current user has an active role in

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :force_download (Boolean)

    Forces the request to hit the server and flush the cached response

Returns:



15
16
17
18
# File 'lib/the_city/api/groups.rb', line 15

def my_groups(options={})
  @my_groups = nil if options.delete(:force_download)
  @my_groups ||= objects_from_response(TheCity::Group, :get, "/me/groups", options)
end