Class: Tinybucket::Api::BranchesApi

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

Overview

Branches 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

Returns repository owner name.

Returns:

  • (String)

    repository owner name.



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

class BranchesApi < BaseApi
  include Tinybucket::Api::Helper::BranchesHelper

  attr_accessor :repo_owner, :repo_slug

  # Send 'GET a branches list for a repository' request
  #
  # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches#get
  #   GET a branches list for a repository
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def list(options = {})
    get_path(
      path_to_list,
      options,
      get_parser(:collection, Tinybucket::Model::Branch)
    )
  end

  # Send 'GET an individual branch' request
  #
  # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches/%7Bname%7D#get
  #   GET an individual branch
  #
  # @param name [String] The branch name
  # @param options [Hash]
  # @return [Tinybucket::Model::Branch]
  def find(name, options = {})
    get_path(
      path_to_find(name),
      options,
      get_parser(:object, Tinybucket::Model::Branch)
    )
  end
end

#repo_slugString

Returns repo_slug.

Returns:



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

class BranchesApi < BaseApi
  include Tinybucket::Api::Helper::BranchesHelper

  attr_accessor :repo_owner, :repo_slug

  # Send 'GET a branches list for a repository' request
  #
  # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches#get
  #   GET a branches list for a repository
  #
  # @param options [Hash]
  # @return [Tinybucket::Model::Page]
  def list(options = {})
    get_path(
      path_to_list,
      options,
      get_parser(:collection, Tinybucket::Model::Branch)
    )
  end

  # Send 'GET an individual branch' request
  #
  # @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/branches/%7Bname%7D#get
  #   GET an individual branch
  #
  # @param name [String] The branch name
  # @param options [Hash]
  # @return [Tinybucket::Model::Branch]
  def find(name, options = {})
    get_path(
      path_to_find(name),
      options,
      get_parser(:object, Tinybucket::Model::Branch)
    )
  end
end

Instance Method Details

#find(name, options = {}) ⇒ Tinybucket::Model::Branch

Send ‘GET an individual branch’ request

Parameters:

  • name (String)

    The branch name

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

Returns:

See Also:



39
40
41
42
43
44
45
# File 'lib/tinybucket/api/branches_api.rb', line 39

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

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

Send ‘GET a branches list for a repository’ request

Parameters:

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

Returns:

See Also:



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

def list(options = {})
  get_path(
    path_to_list,
    options,
    get_parser(:collection, Tinybucket::Model::Branch)
  )
end