tddium_client 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +14 -7
- data/README +2 -0
- data/lib/tddium_client.rb +79 -66
- data/lib/tddium_client/version.rb +1 -1
- data/solano.yml +19 -0
- metadata +24 -5
- checksums.yaml +0 -15
data/Gemfile.lock
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tddium_client (0.
|
4
|
+
tddium_client (0.6.0)
|
5
5
|
httpclient (>= 2.2.5)
|
6
6
|
json
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
12
|
-
crack (0.3
|
11
|
+
addressable (2.4.0)
|
12
|
+
crack (0.4.3)
|
13
|
+
safe_yaml (~> 1.0.0)
|
13
14
|
diff-lcs (1.1.3)
|
14
15
|
fakefs (0.4.0)
|
15
|
-
|
16
|
+
hashdiff (0.3.0)
|
17
|
+
httpclient (2.7.1)
|
16
18
|
json (1.8.3)
|
17
19
|
multi_json (1.3.6)
|
18
20
|
rack (1.4.1)
|
@@ -27,13 +29,15 @@ GEM
|
|
27
29
|
rspec-expectations (2.11.2)
|
28
30
|
diff-lcs (~> 1.1.3)
|
29
31
|
rspec-mocks (2.11.2)
|
32
|
+
safe_yaml (1.0.4)
|
30
33
|
simplecov (0.6.4)
|
31
34
|
multi_json (~> 1.0)
|
32
35
|
simplecov-html (~> 0.5.3)
|
33
36
|
simplecov-html (0.5.3)
|
34
|
-
webmock (1.
|
35
|
-
addressable (
|
36
|
-
crack (>= 0.
|
37
|
+
webmock (1.24.4)
|
38
|
+
addressable (>= 2.3.6)
|
39
|
+
crack (>= 0.3.2)
|
40
|
+
hashdiff
|
37
41
|
|
38
42
|
PLATFORMS
|
39
43
|
ruby
|
@@ -46,3 +50,6 @@ DEPENDENCIES
|
|
46
50
|
simplecov
|
47
51
|
tddium_client!
|
48
52
|
webmock
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
1.10.6
|
data/README
CHANGED
data/lib/tddium_client.rb
CHANGED
@@ -22,7 +22,7 @@ module TddiumClient
|
|
22
22
|
HTTPClient::BadResponseError,
|
23
23
|
SocketError ]
|
24
24
|
|
25
|
-
|
25
|
+
module Error
|
26
26
|
class Base < RuntimeError; end
|
27
27
|
end
|
28
28
|
|
@@ -40,7 +40,7 @@ module TddiumClient
|
|
40
40
|
|
41
41
|
def http_message
|
42
42
|
v = http_response.header.send(:reason_phrase)
|
43
|
-
|
43
|
+
return v
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -76,67 +76,68 @@ module TddiumClient
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def message
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
"API Cert Error: #{@err}"
|
80
|
+
end
|
81
|
+
end
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
class Server < TddiumClient::Result::Base
|
84
|
+
def to_s
|
85
|
+
"#{http_code} #{http_message}"
|
86
|
+
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
end
|
88
|
+
def message
|
89
|
+
"Server Error: #{to_s}"
|
91
90
|
end
|
91
|
+
end
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
class API < TddiumClient::Result::Abstract
|
94
|
+
def initialize(http_response)
|
95
|
+
super
|
96
|
+
end
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
def to_s
|
99
|
+
"#{http_code} #{http_message} (#{status}) #{explanation}"
|
100
|
+
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
102
|
+
def message
|
103
|
+
"API Error: #{to_s}"
|
104
|
+
end
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
def explanation
|
107
|
+
tddium_response["explanation"]
|
108
|
+
end
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
end
|
110
|
+
def status
|
111
|
+
tddium_response["status"]
|
113
112
|
end
|
113
|
+
end
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
class UpgradeRequired < API
|
116
|
+
def initialize(http_response)
|
117
|
+
super
|
118
|
+
end
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
end
|
120
|
+
def message
|
121
|
+
"API Error: #{explanation}"
|
123
122
|
end
|
124
123
|
end
|
124
|
+
end
|
125
125
|
|
126
|
-
|
127
|
-
|
126
|
+
class InternalClient
|
127
|
+
attr_reader :client
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
def initialize(host, port=nil, scheme='https', version=1, caller_version=nil, options={})
|
130
|
+
@debug = ENV['SOLANO_CLIENT_DEBUG']=='true' || false
|
131
|
+
@client = HTTPClient.new
|
132
|
+
if options[:insecure]
|
133
|
+
@client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
134
|
+
end
|
134
135
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
@tddium_config = {"host" => host,
|
137
|
+
"port" => port,
|
138
|
+
"scheme" => scheme,
|
139
|
+
"version" => version,
|
140
|
+
"caller_version" => caller_version}
|
140
141
|
end
|
141
142
|
|
142
143
|
def call_api(method, api_path, params = {}, api_key = nil, retries = 5, xid=nil)
|
@@ -148,6 +149,7 @@ module TddiumClient
|
|
148
149
|
call_params = params.merge({:xid => xid})
|
149
150
|
|
150
151
|
tries = 0
|
152
|
+
debug_msg({:method => method, :path => tddium_uri(api_path), :headers => headers, :body => call_params.to_json})
|
151
153
|
begin
|
152
154
|
http = @client.send(method, tddium_uri(api_path), :body => call_params.to_json, :header => headers)
|
153
155
|
rescue *ERRORS => e
|
@@ -159,8 +161,9 @@ module TddiumClient
|
|
159
161
|
end
|
160
162
|
|
161
163
|
raise Error::Timeout if retries >= 0 && tries > retries
|
162
|
-
|
163
|
-
|
164
|
+
res = Result::API.new(http)
|
165
|
+
debug_msg({:result => res.tddium_response})
|
166
|
+
return res
|
164
167
|
end
|
165
168
|
|
166
169
|
def caller_version
|
@@ -177,23 +180,33 @@ module TddiumClient
|
|
177
180
|
|
178
181
|
protected
|
179
182
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
183
|
+
def debug_msg(msg={})
|
184
|
+
return unless @debug
|
185
|
+
STDERR.puts " "
|
186
|
+
STDERR.puts "TDDIUM CLIENT DEBUG:"
|
187
|
+
msg.each do |key, value|
|
188
|
+
STDERR.puts "#{key}: #{value}"
|
184
189
|
end
|
190
|
+
STDERR.puts " "
|
191
|
+
end
|
185
192
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
URI.join(uri.to_s, "#{tddium_config["version"]}/#{path}").to_s
|
192
|
-
end
|
193
|
+
def version_header
|
194
|
+
hdr = "tddium_client-#{TddiumClient::VERSION}"
|
195
|
+
hdr += ";#{caller_version}" if caller_version
|
196
|
+
hdr
|
197
|
+
end
|
193
198
|
|
194
|
-
|
195
|
-
|
196
|
-
|
199
|
+
def tddium_uri(path)
|
200
|
+
uri = URI.parse("")
|
201
|
+
uri.host = tddium_config["host"]
|
202
|
+
uri.port = tddium_config["port"]
|
203
|
+
uri.scheme = tddium_config["scheme"]
|
204
|
+
URI.join(uri.to_s, "#{tddium_config["version"]}/#{path}").to_s
|
205
|
+
end
|
206
|
+
|
207
|
+
def tddium_config
|
208
|
+
@tddium_config
|
209
|
+
end
|
197
210
|
end
|
198
211
|
|
199
212
|
|
@@ -237,8 +250,8 @@ module TddiumClient
|
|
237
250
|
|
238
251
|
private
|
239
252
|
|
240
|
-
|
241
|
-
|
242
|
-
|
253
|
+
def config_path
|
254
|
+
File.join(File.dirname(__FILE__), "..", "config", "environment.yml")
|
255
|
+
end
|
243
256
|
end
|
244
257
|
end
|
data/solano.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
ruby_version:
|
2
|
+
SPLIT:
|
3
|
+
- 'ruby-1.9.3-p545'
|
4
|
+
- 'ruby-2.1.5'
|
5
|
+
- 'ruby-2.2.2'
|
6
|
+
- 'ruby-2.3.0'
|
7
|
+
coverage:
|
8
|
+
version: 2
|
9
|
+
enabled: true
|
10
|
+
bundler_version: 1.10.6
|
11
|
+
test_pattern:
|
12
|
+
- spec/**_spec.rb
|
13
|
+
cache:
|
14
|
+
per_profile: true
|
15
|
+
key_paths:
|
16
|
+
- Gemfile
|
17
|
+
- Gemfile.lock
|
18
|
+
- tddium_client.gemspec
|
19
|
+
- lib/solano/version.rb
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tddium_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jay Moorthi
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: httpclient
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: json
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rspec
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: webmock
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ! '>='
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ! '>='
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: fakefs
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,6 +94,7 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: rack-test
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
99
|
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
@@ -90,6 +102,7 @@ dependencies:
|
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
@@ -97,6 +110,7 @@ dependencies:
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: simplecov
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
115
|
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
@@ -104,6 +118,7 @@ dependencies:
|
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
123
|
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
@@ -111,6 +126,7 @@ dependencies:
|
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: rake
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
131
|
- - ! '>='
|
116
132
|
- !ruby/object:Gem::Version
|
@@ -118,6 +134,7 @@ dependencies:
|
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
139
|
- - ! '>='
|
123
140
|
- !ruby/object:Gem::Version
|
@@ -141,6 +158,7 @@ files:
|
|
141
158
|
- lib/tddium_client/tddium_spec_helpers.rb
|
142
159
|
- lib/tddium_client/version.rb
|
143
160
|
- lib/webagent_cookie.rb
|
161
|
+
- solano.yml
|
144
162
|
- spec/fixtures/post_suites_201.json
|
145
163
|
- spec/fixtures/post_suites_269_json_status_1.json
|
146
164
|
- spec/fixtures/post_suites_409.json
|
@@ -150,25 +168,26 @@ files:
|
|
150
168
|
- tddium_client.gemspec
|
151
169
|
homepage: https://www.solanolabs.com/
|
152
170
|
licenses: []
|
153
|
-
metadata: {}
|
154
171
|
post_install_message:
|
155
172
|
rdoc_options: []
|
156
173
|
require_paths:
|
157
174
|
- lib
|
158
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
159
177
|
requirements:
|
160
178
|
- - ! '>='
|
161
179
|
- !ruby/object:Gem::Version
|
162
180
|
version: '0'
|
163
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
164
183
|
requirements:
|
165
184
|
- - ! '>='
|
166
185
|
- !ruby/object:Gem::Version
|
167
186
|
version: '0'
|
168
187
|
requirements: []
|
169
188
|
rubyforge_project: tddium_client
|
170
|
-
rubygems_version:
|
189
|
+
rubygems_version: 1.8.23.2
|
171
190
|
signing_key:
|
172
|
-
specification_version:
|
191
|
+
specification_version: 3
|
173
192
|
summary: tddium Client Gem
|
174
193
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NTBjNmMzY2QzMWU5MzFiZTAyMzA0ODBhOTg3MTFmZDQzYTIwMGY2MQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NDNiNDM2NjM1OWRhNjE2ZGE5YjZmZDU3NzIyYzVmMDBhOTMxNmVkYg==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MDQxZGQzNWM3M2JmZTQwMDQxMWZkNWQxM2UwNTFlMzUxZTg4NmYyYmVhNDI5
|
10
|
-
NTExODUxNzI0MWMyZWJjYTU5M2U3MDNjYjllNDU5NjRmZWUwMzBhMDM2NzBk
|
11
|
-
N2NlMzkxZmQ4Y2Y3MjVmZjU1NDA4M2MzMzRlYTMzZTJlZTE1ZGY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YjIwOGEyMGMxMWIzZmMxNTg4ODc2NzdjMzE4Njc5MTNhOGFjMmFlMjUxNTI1
|
14
|
-
OTA1NDI4MTQzNGM5MTM5NTc1ZGE2YWJmZjFmYWI3ODRjNDY4NmQ5Mzc0MTc5
|
15
|
-
MWQ2YTk0ZDQ5OTViYTJhOTZjYmEwYmFmYjk1NzVkM2ExMzI2M2M=
|