packagecloud-ruby 1.0.3 → 1.0.4

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
- ---
2
- SHA1:
3
- data.tar.gz: 99a23e86cf06dfe201a1a7a410dc7f7fb65cefd0
4
- metadata.gz: e2b8d7358cc52d9e697324e54e88416a3fa387ad
5
- SHA512:
6
- data.tar.gz: 3bb10823441626e374cf2d4859880bf49b9708ce7e1df13469f27b311ddfc3fe984a6da98fc2b674f521368e205a3f309c50b8a93da729af2a3052c45f0c2358
7
- metadata.gz: 38bd5a311eb02b863292b9c2f074d751076a8bcf6ea6d1e5a4c465e87d892c8048aac6ebd1ac4363dd68e5a0d1f03b115a978dcb5c9bdc0d76edd8b8dc322387
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6ddc9a00293db9b63f62dc1f235d796eba163e06
4
+ data.tar.gz: 2914de09c42e1e43620d7914af98604c1038137a
5
+ SHA512:
6
+ metadata.gz: f373acfcc22dd73d1049c0a8b94d81bd8fc8baf16bf66b836fd7de2aa274ff04368471e2cb961af7e981058babe83cd07305b6e21d744913cdc9b5a52999d456
7
+ data.tar.gz: 94f4c775eed2d0b108542dedbdb3487c0078be8e5336e203851d022dde5aaafd8265239e2db4dd3198f95a4ff39fdaf4ee4a8a00eb804192d4efbaf414f270c0
@@ -54,7 +54,7 @@ module Packagecloud
54
54
  port = self.connection.port
55
55
  token = self.credentials.token
56
56
 
57
- @excon = Excon.new("#{scheme}://#{token}@#{host}:#{port}")
57
+ @excon = Excon.new("#{scheme}://#{token}@#{host}:#{port}", :connect_timeout => @connection.connect_timeout)
58
58
  assert_valid_credentials
59
59
  end
60
60
 
@@ -243,7 +243,8 @@ module Packagecloud
243
243
  if body != nil
244
244
  request_params.merge!({ :body => body })
245
245
  end
246
- @excon.request(request_params)
246
+
247
+ @excon.request(request_params.merge({:read_timeout => connection.read_timeout, :write_timeout => connection.write_timeout }))
247
248
  end
248
249
 
249
250
  # returns the parsed body of a successful result
@@ -1,11 +1,15 @@
1
1
  module Packagecloud
2
2
  class Connection
3
- attr_reader :scheme, :host, :port
3
+ attr_reader :scheme, :host, :port, :connect_timeout, :read_timeout, :write_timeout
4
4
 
5
- def initialize(scheme="https", host="packagecloud.io", port="443")
5
+ def initialize(scheme="https", host="packagecloud.io", port="443", options={})
6
6
  @scheme = scheme
7
7
  @host = host
8
8
  @port = port
9
+
10
+ @connect_timeout = options[:connect_timeout] || 60
11
+ @read_timeout = options[:read_timeout] || 60
12
+ @write_timeout = options[:write_timeout] || 180
9
13
  end
10
14
  end
11
- end
15
+ end
@@ -1,7 +1,7 @@
1
1
  module Packagecloud
2
2
  MAJOR_VERSION = "1"
3
3
  MINOR_VERSION = "0"
4
- PATCH_VERSION = "3"
4
+ PATCH_VERSION = "4"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
@@ -208,6 +208,27 @@ describe Packagecloud do
208
208
  }.to raise_error(UnauthenticatedException)
209
209
  end
210
210
 
211
+ context "timeouts" do
212
+ it "should have defaults" do
213
+ credentials = Credentials.new("joedamato", "test_token")
214
+ connection = Connection.new("http", "localhost", 8000)
215
+ client = Client.new(credentials, "test_client", connection)
216
+ expect(client.connection.read_timeout).to eql(60)
217
+ expect(client.connection.write_timeout).to eql(180)
218
+ expect(client.connection.connect_timeout).to eql(60)
219
+ end
220
+
221
+ it "should respect passed values" do
222
+ credentials = Credentials.new("joedamato", "test_token")
223
+ timeouts = { :connect_timeout => 10, :read_timeout => 80, :write_timeout => 280 }
224
+ connection = Connection.new("http", "localhost", 8000, timeouts)
225
+ client = Client.new(credentials, "test_client", connection)
226
+ expect(client.connection.read_timeout).to eql(80)
227
+ expect(client.connection.write_timeout).to eql(280)
228
+ expect(client.connection.connect_timeout).to eql(10)
229
+ end
230
+ end
231
+
211
232
  describe "find_distribution_id" do
212
233
  it "should find ubuntu/breezy" do
213
234
  id = @client.find_distribution_id("ubuntu/breezy")
metadata CHANGED
@@ -1,128 +1,166 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: packagecloud-ruby
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2016-03-22 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- prerelease: false
16
- version_requirements: &id001 !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: "0.40"
21
- requirement: *id001
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: excon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.40'
23
20
  type: :runtime
24
- - !ruby/object:Gem::Dependency
25
21
  prerelease: false
26
- version_requirements: &id002 !ruby/object:Gem::Requirement
27
- requirements:
28
- - - ~>
29
- - &id005 !ruby/object:Gem::Version
30
- version: "1.0"
31
- requirement: *id002
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.40'
27
+ - !ruby/object:Gem::Dependency
32
28
  name: multi_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
33
34
  type: :runtime
34
- - !ruby/object:Gem::Dependency
35
35
  prerelease: false
36
- version_requirements: &id003 !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: "1"
41
- requirement: *id003
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
42
  name: json_pure
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1'
43
48
  type: :runtime
44
- - !ruby/object:Gem::Dependency
45
49
  prerelease: false
46
- version_requirements: &id004 !ruby/object:Gem::Requirement
47
- requirements:
48
- - - ~>
49
- - !ruby/object:Gem::Version
50
- version: "0.4"
51
- requirement: *id004
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1'
55
+ - !ruby/object:Gem::Dependency
52
56
  name: mime
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
53
62
  type: :runtime
54
- - !ruby/object:Gem::Dependency
55
63
  prerelease: false
56
- version_requirements: &id006 !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ~>
59
- - *id005
60
- requirement: *id006
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.4'
69
+ - !ruby/object:Gem::Dependency
61
70
  name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
62
76
  type: :development
63
- - !ruby/object:Gem::Dependency
64
77
  prerelease: false
65
- version_requirements: &id007 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ~>
68
- - &id011 !ruby/object:Gem::Version
69
- version: "0.8"
70
- requirement: *id007
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - !ruby/object:Gem::Dependency
71
84
  name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.8'
72
90
  type: :development
73
- - !ruby/object:Gem::Dependency
74
91
  prerelease: false
75
- version_requirements: &id008 !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ~>
78
- - !ruby/object:Gem::Version
79
- version: "2.4"
80
- requirement: *id008
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.8'
97
+ - !ruby/object:Gem::Dependency
81
98
  name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.4'
82
104
  type: :development
83
- - !ruby/object:Gem::Dependency
84
105
  prerelease: false
85
- version_requirements: &id009 !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ~>
88
- - !ruby/object:Gem::Version
89
- version: "0.9"
90
- requirement: *id009
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.4'
111
+ - !ruby/object:Gem::Dependency
91
112
  name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.9'
92
118
  type: :development
93
- - !ruby/object:Gem::Dependency
94
119
  prerelease: false
95
- version_requirements: &id010 !ruby/object:Gem::Requirement
96
- requirements:
97
- - - ~>
98
- - !ruby/object:Gem::Version
99
- version: "0.2"
100
- requirement: *id010
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.9'
125
+ - !ruby/object:Gem::Dependency
101
126
  name: rubygems-tasks
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.2'
102
132
  type: :development
103
- - !ruby/object:Gem::Dependency
104
133
  prerelease: false
105
- version_requirements: &id012 !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ~>
108
- - *id011
109
- requirement: *id012
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.2'
139
+ - !ruby/object:Gem::Dependency
110
140
  name: yard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.8'
111
146
  type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.8'
112
153
  description: library for interacting with packagecloud.io
113
154
  email: joe@packagecloud.io
114
155
  executables: []
115
-
116
156
  extensions: []
117
-
118
157
  extra_rdoc_files: []
119
-
120
- files:
121
- - .document
122
- - .gitignore
123
- - .rspec
124
- - .travis.yml
125
- - .yardopts
158
+ files:
159
+ - ".document"
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".travis.yml"
163
+ - ".yardopts"
126
164
  - Gemfile
127
165
  - LICENSE.txt
128
166
  - README.md
@@ -146,32 +184,30 @@ files:
146
184
  - spec/packagecloud_spec.rb
147
185
  - spec/spec_helper.rb
148
186
  homepage: https://rubygems.org/gems/packagecloud-ruby
149
- licenses:
187
+ licenses:
150
188
  - APL 2.0
151
189
  metadata: {}
152
-
153
190
  post_install_message:
154
191
  rdoc_options: []
155
-
156
- require_paths:
192
+ require_paths:
157
193
  - lib
158
- required_ruby_version: !ruby/object:Gem::Requirement
159
- requirements:
160
- - &id013
161
- - ">="
162
- - !ruby/object:Gem::Version
163
- version: "0"
164
- required_rubygems_version: !ruby/object:Gem::Requirement
165
- requirements:
166
- - *id013
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
167
204
  requirements: []
168
-
169
205
  rubyforge_project:
170
206
  rubygems_version: 2.4.8
171
207
  signing_key:
172
208
  specification_version: 4
173
209
  summary: library for interacting with packagecloud.io
174
- test_files:
210
+ test_files:
175
211
  - spec/fixtures/chewbacca-1.0.0.gem
176
212
  - spec/fixtures/distros.json
177
213
  - spec/fixtures/libampsharp2.0-cil_2.0.4-1_all.deb