Class: Tinybucket::Api::RepoApi

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

Overview

Repo Api client

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

#repo_ownerString



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
# File 'lib/tinybucket/api/repo_api.rb', line 14

class RepoApi < BaseApi
  include Tinybucket::Api::Helper::RepoHelper

  attr_accessor :repo_owner, :repo_slug

  # Send 'GET a repository' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Repository]
  def find(options = {})
    get_path(
      path_to_find,
      options,
      get_parser(:object, Tinybucket::Model::Repository)
    )
  end

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

  # Send 'GET a list of forks' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def forks(options = {})
    get_path(
      path_to_forks,
      options,
      get_parser(:collection, Tinybucket::Model::Repository)
    )
  end
end

#repo_slugString



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
# File 'lib/tinybucket/api/repo_api.rb', line 14

class RepoApi < BaseApi
  include Tinybucket::Api::Helper::RepoHelper

  attr_accessor :repo_owner, :repo_slug

  # Send 'GET a repository' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Repository]
  def find(options = {})
    get_path(
      path_to_find,
      options,
      get_parser(:object, Tinybucket::Model::Repository)
    )
  end

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

  # Send 'GET a list of forks' request
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def forks(options = {})
    get_path(
      path_to_forks,
      options,
      get_parser(:collection, Tinybucket::Model::Repository)
    )
  end
end

Instance Method Details

#find(options = {}) ⇒ Tinybucket::Model::Repository

Send ‘GET a repository’ request



23
24
25
26
27
28
29
# File 'lib/tinybucket/api/repo_api.rb', line 23

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

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

Send ‘GET a list of forks’ request



47
48
49
50
51
52
53
# File 'lib/tinybucket/api/repo_api.rb', line 47

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

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

Send ‘GET a list of watchers’ request



35
36
37
38
39
40
41
# File 'lib/tinybucket/api/repo_api.rb', line 35

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