Class: Tinybucket::Api::UserApi

Inherits:
BaseApi
  • Object
show all
Includes:
Helper::UserHelper
Defined in:
lib/tinybucket/api/user_api.rb

Overview

User Api client

See Also:

Constant Summary

Constants included from Connection

Connection::DEFAULT_USER_AGENT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Connection

#caching?, #clear_cache, #connection

Instance Attribute Details

#usernameString



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/tinybucket/api/user_api.rb', line 12

class UserApi < BaseApi
  include Tinybucket::Api::Helper::UserHelper

  attr_accessor :username

  # Send 'GET the user profile' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Profile]
  def profile(options = {})
    get_path(
      path_to_find,
      options,
      get_parser(:object, Tinybucket::Model::Profile)
    )
  end

  # Send 'GET the list of followers' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def followers(options = {})
    get_path(
      path_to_followers,
      options,
      get_parser(:collection, Tinybucket::Model::Profile)
    )
  end

  # Send 'GET a list of accounts the user is following' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def following(options = {})
    get_path(
      path_to_following,
      options,
      get_parser(:collection, Tinybucket::Model::Profile)
    )
  end

  # Send 'GET the user's repositories' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def repos(options = {})
    get_path(
      path_to_repos,
      options,
      get_parser(:collection, Tinybucket::Model::Repository)
    )
  end
end

Instance Method Details

#followers(options = {}) ⇒ Tinybucket::Model::Page

Send ‘GET the list of followers’ request



33
34
35
36
37
38
39
# File 'lib/tinybucket/api/user_api.rb', line 33

def followers(options = {})
  get_path(
    path_to_followers,
    options,
    get_parser(:collection, Tinybucket::Model::Profile)
  )
end

#following(options = {}) ⇒ Tinybucket::Model::Page

Send ‘GET a list of accounts the user is following’ request



45
46
47
48
49
50
51
# File 'lib/tinybucket/api/user_api.rb', line 45

def following(options = {})
  get_path(
    path_to_following,
    options,
    get_parser(:collection, Tinybucket::Model::Profile)
  )
end

#profile(options = {}) ⇒ Tinybucket::Model::Profile

Send ‘GET the user profile’ request



21
22
23
24
25
26
27
# File 'lib/tinybucket/api/user_api.rb', line 21

def profile(options = {})
  get_path(
    path_to_find,
    options,
    get_parser(:object, Tinybucket::Model::Profile)
  )
end

#repos(options = {}) ⇒ Tinybucket::Model::Page

Send ‘GET the user’s repositories’ request



57
58
59
60
61
62
63
# File 'lib/tinybucket/api/user_api.rb', line 57

def repos(options = {})
  get_path(
    path_to_repos,
    options,
    get_parser(:collection, Tinybucket::Model::Repository)
  )
end