Class: Escobar::Client
- Inherits:
-
Object
- Object
- Escobar::Client
- Defined in:
- lib/escobar/client.rb
Overview
Top-level client for heroku
Defined Under Namespace
Modules: Error Classes: HTTPError, TimeoutError
Instance Attribute Summary collapse
-
#github_token ⇒ Object
readonly
Returns the value of attribute github_token.
-
#heroku ⇒ Object
readonly
Returns the value of attribute heroku.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #app_names ⇒ Object
-
#initialize(github_token, heroku_token) ⇒ Client
constructor
A new instance of Client.
-
#inspect ⇒ Object
mask password.
- #pipelines ⇒ Object
Constructor Details
#initialize(github_token, heroku_token) ⇒ Client
Returns a new instance of Client.
51 52 53 54 |
# File 'lib/escobar/client.rb', line 51 def initialize(github_token, heroku_token) @github_token = github_token @heroku = ::Heroku::Client.new(heroku_token) end |
Instance Attribute Details
#github_token ⇒ Object (readonly)
Returns the value of attribute github_token.
50 51 52 |
# File 'lib/escobar/client.rb', line 50 def github_token @github_token end |
#heroku ⇒ Object (readonly)
Returns the value of attribute heroku.
50 51 52 |
# File 'lib/escobar/client.rb', line 50 def heroku @heroku end |
Class Method Details
.from_environment ⇒ Object
46 47 48 |
# File 'lib/escobar/client.rb', line 46 def self.from_environment new(.github_api_token, .heroku_api_token) end |
Instance Method Details
#[](key) ⇒ Object
63 64 65 |
# File 'lib/escobar/client.rb', line 63 def [](key) pipelines.find { |pipeline| pipeline.name == key } end |
#app_names ⇒ Object
67 68 69 |
# File 'lib/escobar/client.rb', line 67 def app_names pipelines.map(&:name) end |
#inspect ⇒ Object
mask password
57 58 59 60 61 |
# File 'lib/escobar/client.rb', line 57 def inspect inspected = super inspected = inspected.gsub! @github_token, "*******" if @github_token inspected end |
#pipelines ⇒ Object
71 72 73 74 75 |
# File 'lib/escobar/client.rb', line 71 def pipelines @pipelines ||= heroku.get("/pipelines").map do |pipe| ::Heroku::Pipeline.new(self, pipe["id"], pipe["name"]) end end |