tddium_client 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/tddium_client.rb +34 -22
- data/lib/tddium_client/version.rb +1 -1
- data/spec/tddium_client_spec.rb +4 -0
- metadata +5 -9
data/Gemfile.lock
CHANGED
data/lib/tddium_client.rb
CHANGED
@@ -89,19 +89,12 @@ module TddiumClient
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
class
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
def environment=(new_environment)
|
101
|
-
env = new_environment.to_s
|
102
|
-
raise ArgumentError, "Invalid environment #{env}" unless @all_config[env]
|
103
|
-
@tddium_config = @all_config[env]
|
104
|
-
@environment = env
|
92
|
+
class InternalClient
|
93
|
+
def initialize(host, port=nil, scheme='https', version=1)
|
94
|
+
@tddium_config = {"host" => host,
|
95
|
+
"port" => port,
|
96
|
+
"scheme" => scheme,
|
97
|
+
"version" => version}
|
105
98
|
end
|
106
99
|
|
107
100
|
def call_api(method, api_path, params = {}, api_key = nil, retries = 5)
|
@@ -124,22 +117,41 @@ module TddiumClient
|
|
124
117
|
Result::API.new(http)
|
125
118
|
end
|
126
119
|
|
127
|
-
|
120
|
+
protected
|
128
121
|
|
129
122
|
def tddium_uri(path)
|
130
123
|
uri = URI.parse("")
|
131
|
-
uri.host = tddium_config["
|
132
|
-
uri.port = tddium_config["
|
133
|
-
uri.scheme = tddium_config["
|
134
|
-
URI.join(uri.to_s, "#{tddium_config["
|
135
|
-
end
|
136
|
-
|
137
|
-
def config_path
|
138
|
-
File.join(File.dirname(__FILE__), "..", "config", "environment.yml")
|
124
|
+
uri.host = tddium_config["host"]
|
125
|
+
uri.port = tddium_config["port"]
|
126
|
+
uri.scheme = tddium_config["scheme"]
|
127
|
+
URI.join(uri.to_s, "#{tddium_config["version"]}/#{path}").to_s
|
139
128
|
end
|
140
129
|
|
141
130
|
def tddium_config
|
142
131
|
@tddium_config
|
143
132
|
end
|
144
133
|
end
|
134
|
+
|
135
|
+
|
136
|
+
class Client < InternalClient
|
137
|
+
attr_reader :environment
|
138
|
+
|
139
|
+
def initialize(env = :development)
|
140
|
+
@all_config = YAML.load(File.read(config_path))
|
141
|
+
self.environment = env.to_s
|
142
|
+
end
|
143
|
+
|
144
|
+
def environment=(new_environment)
|
145
|
+
env = new_environment.to_s
|
146
|
+
raise ArgumentError, "Invalid environment #{env}" unless @all_config[env]
|
147
|
+
@tddium_config = @all_config[env]["api"]
|
148
|
+
@environment = env
|
149
|
+
end
|
150
|
+
|
151
|
+
private
|
152
|
+
|
153
|
+
def config_path
|
154
|
+
File.join(File.dirname(__FILE__), "..", "config", "environment.yml")
|
155
|
+
end
|
156
|
+
end
|
145
157
|
end
|
data/spec/tddium_client_spec.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tddium_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jay Moorthi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-16 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -151,13 +151,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
requirements: []
|
152
152
|
|
153
153
|
rubyforge_project: tddium_client
|
154
|
-
rubygems_version: 1.
|
154
|
+
rubygems_version: 1.6.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 3
|
157
157
|
summary: tddium Client Gem
|
158
|
-
test_files:
|
159
|
-
|
160
|
-
- spec/fixtures/post_suites_269_json_status_1.json
|
161
|
-
- spec/fixtures/post_suites_409.json
|
162
|
-
- spec/spec_helper.rb
|
163
|
-
- spec/tddium_client_spec.rb
|
158
|
+
test_files: []
|
159
|
+
|