semaphore_client 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1adffa7f79afb26ccdcda94fb97fef59bc993f6
4
- data.tar.gz: 3524760b28f5da952a3d5017a21025cf71933c9f
3
+ metadata.gz: e793695882132ac56777d359ac84177c59a37a21
4
+ data.tar.gz: 64be6e2635a066d7dc071cb24243080eabc97d6c
5
5
  SHA512:
6
- metadata.gz: 6fffd069ff3e257e7fe710abfb3191a0e3bef367d1125113d80a881833fd194c72eeb7c12df963d3fe7bfde7eeb288dd561e274db39cdb14c74d903a30c3eed6
7
- data.tar.gz: cdadf05b50229227bd17c675466e716df2f5278bfd8430e704ed466c8f94f2cec846fe27fe141048abd6fcb24a232c6e96173737c88c5d2d949533bf27080905
6
+ metadata.gz: fb493fdc647993a9a50a646a669792a578b5ba66aa0d9e035da3db329fd5ee0121077917a2390588b121ce3ad14d35adb05bb308c515239ac5fb61509bb7e771
7
+ data.tar.gz: 83f1911bb8279c83b1c569d275842e5b6b6bfa3e5e51e80f689802da5f7c2ee040f590374be234e492f265a6d988677c3ed969703c8728a68e5ac14bab5e1edd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- semaphore_client (3.1.0)
4
+ semaphore_client (3.2.0)
5
5
  faraday
6
6
 
7
7
  GEM
@@ -0,0 +1,65 @@
1
+ class SemaphoreClient
2
+ module Api
3
+ class Pipeline
4
+ def initialize(http_client)
5
+ @http_client = http_client
6
+ end
7
+
8
+
9
+ def list(params = nil, options = {})
10
+ list!(params, options)
11
+ rescue SemaphoreClient::Exceptions::ResponseError
12
+ end
13
+
14
+ def list!(params = nil, options = {})
15
+ path = "/pipelines"
16
+
17
+ @http_client.get(path, params, options).body.map { |e| SemaphoreClient::Model::Pipeline.load(e) }
18
+ end
19
+
20
+
21
+
22
+ def create(params = nil, options = {})
23
+ create!(params, options)
24
+ rescue SemaphoreClient::Exceptions::ResponseError
25
+ end
26
+
27
+ def create!(params = nil, options = {})
28
+ path = "/pipelines"
29
+ response = @http_client.post(path, params, options)
30
+
31
+ SemaphoreClient::Model::Pipeline.load(response.body)
32
+ end
33
+
34
+
35
+
36
+ def get(id, params = nil, options = {})
37
+ get!(id, params, options)
38
+ rescue SemaphoreClient::Exceptions::ResponseError
39
+ end
40
+
41
+ def get!(id, params = nil, options = {})
42
+ path = "/pipelines/#{id}"
43
+ response = @http_client.get(path, params = {})
44
+
45
+ SemaphoreClient::Model::Pipeline.load(response.body)
46
+ end
47
+
48
+
49
+
50
+ def update(id, params = nil, options = {})
51
+ update!(id, params, options)
52
+ rescue SemaphoreClient::Exceptions::ResponseError
53
+ end
54
+
55
+ def update!(id, params = nil, options = {})
56
+ path = "/pipelines/#{id}"
57
+ response = @http_client.patch(path, params)
58
+
59
+ SemaphoreClient::Model::Pipeline.load(response.body)
60
+ end
61
+
62
+
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,52 @@
1
+ class SemaphoreClient
2
+ module Model
3
+ class Pipeline
4
+ attr_reader :id
5
+ attr_accessor :terminate_request
6
+
7
+ def self.load(attributes)
8
+ new.load(attributes)
9
+ end
10
+
11
+ def self.create(attributes)
12
+ new.update(attributes)
13
+ end
14
+
15
+ def load(attributes)
16
+ attributes = symbolize_keys(attributes)
17
+
18
+ @id = attributes[:id] if attributes.key?(:id)
19
+
20
+ self
21
+ end
22
+
23
+ def update(attributes)
24
+ attributes = symbolize_keys(attributes)
25
+
26
+ updatable_keys = [:terminate_request]
27
+
28
+ if (attributes.keys - updatable_keys).any?
29
+ raise SemaphoreClient::Exceptions::AttributeNotAvailable
30
+ end
31
+
32
+ @terminate_request = attributes[:terminate_request] if attributes.key?(:terminate_request)
33
+
34
+ self
35
+ end
36
+
37
+ def serialize
38
+ object_hash = {
39
+ "terminate_request" => @terminate_request,
40
+ }
41
+
42
+ object_hash.delete_if { |_, value| value.nil? }
43
+ end
44
+
45
+ private
46
+
47
+ def symbolize_keys(hash)
48
+ Hash[hash.map { |key, value| [key.to_sym, value] }]
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,3 +1,3 @@
1
1
  class SemaphoreClient
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
@@ -14,6 +14,7 @@ require "semaphore_client/model/project"
14
14
  require "semaphore_client/model/secret"
15
15
  require "semaphore_client/model/env_var"
16
16
  require "semaphore_client/model/config_file"
17
+ require "semaphore_client/model/pipeline"
17
18
  require "semaphore_client/api/user"
18
19
  require "semaphore_client/api/org"
19
20
  require "semaphore_client/api/team"
@@ -21,6 +22,7 @@ require "semaphore_client/api/project"
21
22
  require "semaphore_client/api/secret"
22
23
  require "semaphore_client/api/env_var"
23
24
  require "semaphore_client/api/config_file"
25
+ require "semaphore_client/api/pipeline"
24
26
 
25
27
  class SemaphoreClient
26
28
  API_URL = "https://api.semaphoreci.com"
@@ -63,6 +65,10 @@ class SemaphoreClient
63
65
  @config_file_api ||= SemaphoreClient::Api::ConfigFile.new(http_client)
64
66
  end
65
67
 
68
+ def pipelines
69
+ @pipeline_api ||= SemaphoreClient::Api::Pipeline.new(http_client)
70
+ end
71
+
66
72
  private
67
73
 
68
74
  def http_client
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semaphore_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jovan Ivanović
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -115,6 +115,7 @@ files:
115
115
  - lib/semaphore_client/api/config_file.rb
116
116
  - lib/semaphore_client/api/env_var.rb
117
117
  - lib/semaphore_client/api/org.rb
118
+ - lib/semaphore_client/api/pipeline.rb
118
119
  - lib/semaphore_client/api/project.rb
119
120
  - lib/semaphore_client/api/secret.rb
120
121
  - lib/semaphore_client/api/team.rb
@@ -124,6 +125,7 @@ files:
124
125
  - lib/semaphore_client/model/config_file.rb
125
126
  - lib/semaphore_client/model/env_var.rb
126
127
  - lib/semaphore_client/model/org.rb
128
+ - lib/semaphore_client/model/pipeline.rb
127
129
  - lib/semaphore_client/model/project.rb
128
130
  - lib/semaphore_client/model/secret.rb
129
131
  - lib/semaphore_client/model/team.rb