client 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/client/version.rb +1 -1
- data/lib/client.rb +5 -3
- data/spec/client/client_spec.rb +5 -3
- data/spec/fixtures/client.yml +2 -0
- data/spec/spec_helper.rb +2 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e5ccace8cea9232907b87fdf819d33a816efd29
|
4
|
+
data.tar.gz: 8ba1b52535e868b6cf43b449220dfa24dc2e7a1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3095f3f24073ae5923b1815be9cc880ac61cc200f117be0c4218859067f562047c456d092835af0f0be5df0dd56bf6dac127af6bb1f0224d1345902f646782ca
|
7
|
+
data.tar.gz: 7d092e62613ed3a0869b9bb986d982427d27cff50e863920bf0f56c782edb3d9ed7f0a1640f019dac7256bca85e6fe141cf26573498b32ac4a0ac796851a0894
|
data/lib/client/version.rb
CHANGED
data/lib/client.rb
CHANGED
@@ -47,7 +47,7 @@ class Client
|
|
47
47
|
@clients ||= {}
|
48
48
|
end
|
49
49
|
|
50
|
-
def load_clients(path =
|
50
|
+
def load_clients(path = "#{Dir.pwd}/client.yml")
|
51
51
|
begin
|
52
52
|
clients.merge! YAML.load_file(path)
|
53
53
|
rescue
|
@@ -60,10 +60,10 @@ class Client
|
|
60
60
|
'''
|
61
61
|
{}
|
62
62
|
end
|
63
|
+
generate_clients
|
63
64
|
end
|
64
65
|
|
65
|
-
def
|
66
|
-
load_clients if clients.empty?
|
66
|
+
def generate_clients
|
67
67
|
clients.each do |name, info|
|
68
68
|
Class.new(Base) do
|
69
69
|
self.endpoint = info.fetch('endpoint')
|
@@ -73,5 +73,7 @@ class Client
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
load_clients
|
76
78
|
end
|
77
79
|
|
data/spec/client/client_spec.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Client do
|
4
|
+
it 'defaults to client.yml if no file is loaded' do
|
5
|
+
Client::RandomClient.should be
|
6
|
+
end
|
7
|
+
|
4
8
|
describe 'when there is a config' do
|
5
9
|
before do
|
6
10
|
stub_request(:any, /.*twitter.*/)
|
7
|
-
Client.load_clients(
|
8
|
-
File.dirname(__FILE__)))
|
9
|
-
Client.init
|
11
|
+
Client.load_clients("#{Dir.pwd}/twitter.yml")
|
10
12
|
end
|
11
13
|
|
12
14
|
describe '#load_clients' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bonzofenix
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/client.rb
|
84
84
|
- lib/client/version.rb
|
85
85
|
- spec/client/client_spec.rb
|
86
|
+
- spec/fixtures/client.yml
|
86
87
|
- spec/fixtures/twitter.yml
|
87
88
|
- spec/spec_helper.rb
|
88
89
|
homepage: ''
|
@@ -111,5 +112,6 @@ specification_version: 4
|
|
111
112
|
summary: solves rest comunications
|
112
113
|
test_files:
|
113
114
|
- spec/client/client_spec.rb
|
115
|
+
- spec/fixtures/client.yml
|
114
116
|
- spec/fixtures/twitter.yml
|
115
117
|
- spec/spec_helper.rb
|