Class: Tinybucket::Api::DiffApi

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

Overview

Diff 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

#repo_ownerString

Returns repository owner name.

Returns:

  • (String)

    repository owner name.



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

class DiffApi < BaseApi
  include Tinybucket::Api::Helper::DiffHelper

  attr_accessor :repo_owner, :repo_slug

  # Send 'GET a diff' request
  #
  # @param spec [String] A specification such as a branch name,
  #   revision, or commit SHA.
  # @param options [Hash]
  # @return [String] diff as raw text
  def find(spec, options = {})
    get_path(path_to_find(spec), options)
  end

  # Send 'GET a patch' request
  #
  # @param spec [String] A specification such as a branch name,
  #   revision, or commit SHA.
  # @param options [Hash]
  # @return [String] patch as raw text
  def find_patch(spec, options = {})
    get_path(path_to_patch(spec), options)
  end
end

#repo_slugString

Returns repository slug.

Returns:



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

class DiffApi < BaseApi
  include Tinybucket::Api::Helper::DiffHelper

  attr_accessor :repo_owner, :repo_slug

  # Send 'GET a diff' request
  #
  # @param spec [String] A specification such as a branch name,
  #   revision, or commit SHA.
  # @param options [Hash]
  # @return [String] diff as raw text
  def find(spec, options = {})
    get_path(path_to_find(spec), options)
  end

  # Send 'GET a patch' request
  #
  # @param spec [String] A specification such as a branch name,
  #   revision, or commit SHA.
  # @param options [Hash]
  # @return [String] patch as raw text
  def find_patch(spec, options = {})
    get_path(path_to_patch(spec), options)
  end
end

Instance Method Details

#find(spec, options = {}) ⇒ String

Send ‘GET a diff’ request

Parameters:

  • spec (String)

    A specification such as a branch name, revision, or commit SHA.

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

Returns:

  • (String)

    diff as raw text



25
26
27
# File 'lib/tinybucket/api/diff_api.rb', line 25

def find(spec, options = {})
  get_path(path_to_find(spec), options)
end

#find_patch(spec, options = {}) ⇒ String

Send ‘GET a patch’ request

Parameters:

  • spec (String)

    A specification such as a branch name, revision, or commit SHA.

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

Returns:

  • (String)

    patch as raw text



35
36
37
# File 'lib/tinybucket/api/diff_api.rb', line 35

def find_patch(spec, options = {})
  get_path(path_to_patch(spec), options)
end