Class: SemaphoreApi::Client
- Inherits:
-
Object
- Object
- SemaphoreApi::Client
- Defined in:
- lib/semaphore_api/client.rb,
lib/semaphore_api/client/builds.rb,
lib/semaphore_api/client/deploys.rb,
lib/semaphore_api/client/servers.rb,
lib/semaphore_api/client/branches.rb,
lib/semaphore_api/client/projects.rb,
lib/semaphore_api/client/webhooks.rb
Defined Under Namespace
Modules: Branches, Builds, Deploys, Projects, Servers, WebHooks
Instance Method Summary collapse
- #agent ⇒ Object
- #end_point ⇒ Object
- #get(path, options = {}) ⇒ Object
-
#initialize(auth_token, end_point = nil) ⇒ Client
constructor
A new instance of Client.
-
#inspect ⇒ Object
hide auth_token.
Methods included from Deploys
Methods included from Servers
#server_history, #server_status, #servers
Methods included from Builds
Methods included from WebHooks
Methods included from Branches
#branch_history, #branch_status, #branches
Methods included from Projects
Constructor Details
#initialize(auth_token, end_point = nil) ⇒ Client
19 20 21 22 |
# File 'lib/semaphore_api/client.rb', line 19 def initialize(auth_token, end_point=nil) @auth_token = auth_token @end_point = end_point end |
Instance Method Details
#agent ⇒ Object
30 31 32 |
# File 'lib/semaphore_api/client.rb', line 30 def agent @agent ||= Zoid::Agent.new(end_point) end |
#end_point ⇒ Object
34 35 36 |
# File 'lib/semaphore_api/client.rb', line 34 def end_point @end_point || "https://semaphoreci.com" end |
#get(path, options = {}) ⇒ Object
24 25 26 27 28 |
# File 'lib/semaphore_api/client.rb', line 24 def get(path, = {}) response = agent.get("/api/v1/#{path}", {:auth_token => @auth_token}) response.body end |
#inspect ⇒ Object
hide auth_token
39 40 41 |
# File 'lib/semaphore_api/client.rb', line 39 def inspect super.gsub! @auth_token, "*******" end |