Class: SemaphoreApi::Client

Inherits:
Object
  • Object
show all
Includes:
Branches, Builds, Deploys, Projects, Servers, WebHooks
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

Methods included from Deploys

#deploy, #deploy_log

Methods included from Servers

#server_history, #server_status, #servers

Methods included from Builds

#build, #build_log

Methods included from WebHooks

#webhooks

Methods included from Branches

#branch_history, #branch_status, #branches

Methods included from Projects

#project, #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

#agentObject



30
31
32
# File 'lib/semaphore_api/client.rb', line 30

def agent
  @agent ||= Zoid::Agent.new(end_point)
end

#end_pointObject



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, options = {})
  response = agent.get("/api/v1/#{path}", {:auth_token => @auth_token})

  response.body
end

#inspectObject

hide auth_token



39
40
41
# File 'lib/semaphore_api/client.rb', line 39

def inspect
  super.gsub! @auth_token, "*******"
end