client 0.0.3 → 0.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
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f0806c66e3ad5ab1ce9c8c13a33ba927a00330a
4
- data.tar.gz: b2024bbac90d6877f7ce912b78d26af8ef4ba6c7
3
+ metadata.gz: 5e5ccace8cea9232907b87fdf819d33a816efd29
4
+ data.tar.gz: 8ba1b52535e868b6cf43b449220dfa24dc2e7a1b
5
5
  SHA512:
6
- metadata.gz: 4b9705290c64b92bd2c18f3accf23d6a9c354af47d22b92f1f40eba243c3f32a92f18072062945ab85516ecd84f2c855549f8225a9349e7474aaf4727c1e3354
7
- data.tar.gz: 34f1574ebdca6336fca4f71effd5d091dd910d0ba4cf47d2492ec8252c0fad521f3a2fc6c534bab7ff0f0649ee295a7ca5d0bc90d6c3a0ace363c59bcdbed5cd
6
+ metadata.gz: 3095f3f24073ae5923b1815be9cc880ac61cc200f117be0c4218859067f562047c456d092835af0f0be5df0dd56bf6dac127af6bb1f0224d1345902f646782ca
7
+ data.tar.gz: 7d092e62613ed3a0869b9bb986d982427d27cff50e863920bf0f56c782edb3d9ed7f0a1640f019dac7256bca85e6fe141cf26573498b32ac4a0ac796851a0894
@@ -1,3 +1,3 @@
1
1
  class Client
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/client.rb CHANGED
@@ -47,7 +47,7 @@ class Client
47
47
  @clients ||= {}
48
48
  end
49
49
 
50
- def load_clients(path = 'client.yml')
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 init
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
 
@@ -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(File.expand_path('../fixtures/twitter.yml',
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
@@ -0,0 +1,2 @@
1
+ random_client:
2
+ endpoint: 'www.google.com'
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'bundler/setup'
2
2
  require 'webmock/rspec'
3
+
4
+ Dir.chdir File.expand_path('fixtures', File.dirname(__FILE__))
3
5
  require 'client'
4
6
 
5
7
 
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.3
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