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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tddium_client (0.0.7)
4
+ tddium_client (0.0.8)
5
5
  httparty
6
6
  json
7
7
 
data/lib/tddium_client.rb CHANGED
@@ -89,19 +89,12 @@ module TddiumClient
89
89
  end
90
90
  end
91
91
 
92
- class Client
93
- attr_reader :environment
94
-
95
- def initialize(env = :development)
96
- @all_config = YAML.load(File.read(config_path))
97
- self.environment = env.to_s
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
- private
120
+ protected
128
121
 
129
122
  def tddium_uri(path)
130
123
  uri = URI.parse("")
131
- uri.host = tddium_config["api"]["host"]
132
- uri.port = tddium_config["api"]["port"]
133
- uri.scheme = tddium_config["api"]["scheme"]
134
- URI.join(uri.to_s, "#{tddium_config["api"]["version"]}/#{path}").to_s
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
@@ -3,5 +3,5 @@ Copyright (c) 2011 Solano Labs All Rights Reserved
3
3
  =end
4
4
 
5
5
  module TddiumClient
6
- VERSION = "0.0.7"
6
+ VERSION = "0.0.8"
7
7
  end
@@ -196,6 +196,10 @@ describe "TddiumClient" do
196
196
  end
197
197
  end
198
198
 
199
+ describe "InternalClient" do
200
+ pending "implement InternalClient tests"
201
+ end
202
+
199
203
  describe "Client" do
200
204
  include FakeFS::SpecHelpers
201
205
  include TddiumSpecHelpers
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.7
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-10 00:00:00 -07:00
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.5.2
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
- - spec/fixtures/post_suites_201.json
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
+