Class: Bitbucket::ApiConnection
- Inherits:
-
Object
- Object
- Bitbucket::ApiConnection
- Includes:
- ExponentialBackoff
- Defined in:
- lib/bitbucket/api_connection.rb
Constant Summary
Constants included from ExponentialBackoff
ExponentialBackoff::EXPONENTIAL_BASE, ExponentialBackoff::INITIAL_DELAY, ExponentialBackoff::MAX_RETRIES, ExponentialBackoff::RateLimitError
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#app_password ⇒ Object
readonly
Returns the value of attribute app_password.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #get(path, extra_query = {}) ⇒ Object
-
#initialize(options = {}) ⇒ ApiConnection
constructor
A new instance of ApiConnection.
Methods included from ExponentialBackoff
#retry_with_exponential_backoff
Constructor Details
#initialize(options = {}) ⇒ ApiConnection
Returns a new instance of ApiConnection.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bitbucket/api_connection.rb', line 9 def initialize( = {}) @api_version = .fetch(:api_version, Bitbucket::Connection::DEFAULT_API_VERSION) @base_uri = .fetch(:base_uri, Bitbucket::Connection::DEFAULT_BASE_URI) @default_query = .fetch(:query, Bitbucket::Connection::DEFAULT_QUERY) @username = [:username] @app_password = [:app_password] @email = [:email] @api_token = [:api_token] end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
7 8 9 |
# File 'lib/bitbucket/api_connection.rb', line 7 def api_token @api_token end |
#app_password ⇒ Object (readonly)
Returns the value of attribute app_password.
7 8 9 |
# File 'lib/bitbucket/api_connection.rb', line 7 def app_password @app_password end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
7 8 9 |
# File 'lib/bitbucket/api_connection.rb', line 7 def email @email end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/bitbucket/api_connection.rb', line 7 def username @username end |
Instance Method Details
#get(path, extra_query = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bitbucket/api_connection.rb', line 20 def get(path, extra_query = {}) response = retry_with_exponential_backoff do Import::Clients::HTTP.get(build_url(path), basic_auth: basic_auth, headers: headers, query: extra_query) end response.parsed_response end |