Class: Git::Semaphore::Api
- Inherits:
-
Object
- Object
- Git::Semaphore::Api
- Defined in:
- lib/git-semaphore/api.rb
Constant Summary collapse
- SEMAPHORE_API_HOST =
'semaphoreapp.com'- SEMAPHORE_API_URI =
'/api/v1'
Class Method Summary collapse
- .branches_uri(project_hash_id, auth_token) ⇒ Object
-
.get_response(uri) ⇒ Object
helper functions.
- .history_uri(project_hash_id, branch_id, auth_token) ⇒ Object
- .projects_uri(auth_token) ⇒ Object
- .status_uri(project_hash_id, branch_id, auth_token) ⇒ Object
Class Method Details
.branches_uri(project_hash_id, auth_token) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/git-semaphore/api.rb', line 21 def self.branches_uri project_hash_id, auth_token URI::HTTPS.build( :host => SEMAPHORE_API_HOST, :path => File.join(SEMAPHORE_API_URI, 'projects', project_hash_id, 'branches'), :query => "auth_token=#{auth_token}" ) end |
.get_response(uri) ⇒ Object
helper functions
47 48 49 50 51 |
# File 'lib/git-semaphore/api.rb', line 47 def self.get_response uri ::Net::HTTP.start(uri.host, uri.port, :use_ssl => (uri.scheme == 'https'), :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |net_http| net_http.get(uri.request_uri) end end |
.history_uri(project_hash_id, branch_id, auth_token) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/git-semaphore/api.rb', line 37 def self.history_uri project_hash_id, branch_id, auth_token URI::HTTPS.build( :host => SEMAPHORE_API_HOST, :path => File.join(SEMAPHORE_API_URI, 'projects', project_hash_id, branch_id), :query => "auth_token=#{auth_token}" ) end |
.projects_uri(auth_token) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/git-semaphore/api.rb', line 13 def self.projects_uri auth_token URI::HTTPS.build( :host => SEMAPHORE_API_HOST, :path => File.join(SEMAPHORE_API_URI, 'projects'), :query => "auth_token=#{auth_token}" ) end |
.status_uri(project_hash_id, branch_id, auth_token) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/git-semaphore/api.rb', line 29 def self.status_uri project_hash_id, branch_id, auth_token URI::HTTPS.build( :host => SEMAPHORE_API_HOST, :path => File.join(SEMAPHORE_API_URI, 'projects', project_hash_id, branch_id, 'status'), :query => "auth_token=#{auth_token}" ) end |