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
- #delete(path, options = {}) ⇒ 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.
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
Methods included from Deploys
#deploy, #deploy_log, #launch_deploy, #stop_deploy
Methods included from Servers
#server_history, #server_status, #servers
Methods included from Builds
#build, #build_log, #launch_build, #stop_build
Methods included from WebHooks
#create_webhook, #delete_webhook, #edit_webhook, #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
48 49 50 |
# File 'lib/semaphore_api/client.rb', line 48 def agent @agent ||= Zoid::Agent.new(end_point) end |
#delete(path, options = {}) ⇒ Object
42 43 44 45 46 |
# File 'lib/semaphore_api/client.rb', line 42 def delete(path, = {}) response = agent.delete("/api/v1/#{path}", .merge(:auth_token => @auth_token)) response.body end |
#end_point ⇒ Object
52 53 54 |
# File 'lib/semaphore_api/client.rb', line 52 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}", .merge(:auth_token => @auth_token)) response.body end |
#inspect ⇒ Object
hide auth_token
57 58 59 |
# File 'lib/semaphore_api/client.rb', line 57 def inspect super.gsub! @auth_token, "*******" end |
#post(path, options = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/semaphore_api/client.rb', line 30 def post(path, = {}) response = agent.post("/api/v1/#{path}", .merge(:auth_token => @auth_token)) response.body end |
#put(path, options = {}) ⇒ Object
36 37 38 39 40 |
# File 'lib/semaphore_api/client.rb', line 36 def put(path, = {}) response = agent.put("/api/v1/#{path}", .merge(:auth_token => @auth_token)) response.body end |