Class: SemaphoreClient::Api::Pipeline
- Inherits:
-
Object
- Object
- SemaphoreClient::Api::Pipeline
- Defined in:
- lib/semaphore_client/api/pipeline.rb
Instance Method Summary collapse
- #create(params = nil, options = {}) ⇒ Object
- #create!(params = nil, options = {}) ⇒ Object
- #get(id, params = nil, options = {}) ⇒ Object
- #get!(id, params = nil, options = {}) ⇒ Object
-
#initialize(http_client) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #list(params = nil, options = {}) ⇒ Object
- #list!(params = nil, options = {}) ⇒ Object
- #update(id, params = nil, options = {}) ⇒ Object
- #update!(id, params = nil, options = {}) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ Pipeline
Returns a new instance of Pipeline.
4 5 6 |
# File 'lib/semaphore_client/api/pipeline.rb', line 4 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#create(params = nil, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/semaphore_client/api/pipeline.rb', line 22 def create(params = nil, = {}) create!(params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#create!(params = nil, options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/semaphore_client/api/pipeline.rb', line 27 def create!(params = nil, = {}) path = "/pipelines" response = @http_client.post(path, params, ) SemaphoreClient::Model::Pipeline.load(response.body) end |
#get(id, params = nil, options = {}) ⇒ Object
36 37 38 39 |
# File 'lib/semaphore_client/api/pipeline.rb', line 36 def get(id, params = nil, = {}) get!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#get!(id, params = nil, options = {}) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/semaphore_client/api/pipeline.rb', line 41 def get!(id, params = nil, = {}) path = "/pipelines/#{id}" response = @http_client.get(path, params = {}) SemaphoreClient::Model::Pipeline.load(response.body) end |
#list(params = nil, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/semaphore_client/api/pipeline.rb', line 9 def list(params = nil, = {}) list!(params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#list!(params = nil, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/semaphore_client/api/pipeline.rb', line 14 def list!(params = nil, = {}) path = "/pipelines" @http_client.get(path, params, ).body.map { |e| SemaphoreClient::Model::Pipeline.load(e) } end |
#update(id, params = nil, options = {}) ⇒ Object
50 51 52 53 |
# File 'lib/semaphore_client/api/pipeline.rb', line 50 def update(id, params = nil, = {}) update!(id, params, ) rescue SemaphoreClient::Exceptions::ResponseError end |
#update!(id, params = nil, options = {}) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/semaphore_client/api/pipeline.rb', line 55 def update!(id, params = nil, = {}) path = "/pipelines/#{id}" response = @http_client.patch(path, params) SemaphoreClient::Model::Pipeline.load(response.body) end |