service_api 0.0.4 → 0.0.5

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: 17d0157549889eafc0a06c5a154157f06e386daf
4
- data.tar.gz: ffea55d1004c3be0a232495b0bffa9ce27c81dae
3
+ metadata.gz: 1ed0b2e5f4d98f84bf309258e33da930bebfcab9
4
+ data.tar.gz: c3af2e6e274483ee78cd39be88c749990bdc2397
5
5
  SHA512:
6
- metadata.gz: a7962f428ede59c30b397374042389a03302decdce4418d02bc70b641a6abe9f82af097e0bc40e3d1d504c8bf0b84b44d528673ce3160cab827d1f39c2260237
7
- data.tar.gz: e0ced0bd45724356fdfdf74f51c4a7eb74cd9778ef4b30487ea08ffbc92fe3423969fe8b1f1924fa05da02bff363ab55794084df5adc3ce9d6e7732c2dba5134
6
+ metadata.gz: 14e1ad28f4f1f4d7ef719787de7f1885a15c29c97aa79263378758ad8e97dc5641db1fa935305ab99f627cb4e31590c047d50867ea5ae44a3d03fab1b92464c7
7
+ data.tar.gz: f092e6bfbbd19fa3962774a3db738e24d5dab93a8515aa5836bf8de22d37c57f35b9bf5c0772c8add90870f164ab1313c1ee3beecf17e00a3434634309063e0e
@@ -17,13 +17,12 @@ module ServiceApi
17
17
  # end
18
18
  #
19
19
  module BaseFaraday
20
-
21
- # Initilizer require client class as parameter
20
+ # Initilizer require config hash as parameter
22
21
  #
23
- # MyApi.new(client)
22
+ # MyApi.new(config)
24
23
  #
25
- def initialize(client)
26
- @client = client
24
+ def initialize(config)
25
+ @config = config
27
26
  @params = {}
28
27
  end
29
28
 
@@ -73,10 +72,10 @@ module ServiceApi
73
72
  builder.response :xml, content_type: /\bxml$/
74
73
  builder.response :json, content_type: /\bjson$/
75
74
 
76
- if @client.options[:adapter] == :test
77
- builder.adapter @client.options[:adapter], @client.options[:adapter_options]
75
+ if @config[:adapter] == :test
76
+ builder.adapter @config[:adapter], @config[:adapter_options]
78
77
  else
79
- builder.adapter @client.options[:adapter]
78
+ builder.adapter @config[:adapter]
80
79
  end
81
80
  end
82
81
  end
@@ -1,3 +1,3 @@
1
1
  module ServiceApi
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -1,17 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
- class Client
4
- def options
5
- { adapter: :test, adapter_options: faraday_stubs }
6
- end
7
-
8
- def faraday_stubs
9
- Faraday::Adapter::Test::Stubs.new do |stub|
10
- stub.get('/test/request?api_key=abcd&sample=true') { [200, {}, 'OK'] }
11
- end
12
- end
13
- end
14
-
15
3
  class MyApi
16
4
  include ServiceApi::BaseFaraday
17
5
 
@@ -47,9 +35,16 @@ class Sample2Api < MyApi
47
35
  end
48
36
 
49
37
  describe ServiceApi::BaseFaraday do
50
- let(:client) { Client.new }
51
- let(:model) { SampleApi.new(client) }
52
- let(:model2) { Sample2Api.new(client) }
38
+ let(:config) do
39
+ {
40
+ adapter: :test,
41
+ adapter_options: Faraday::Adapter::Test::Stubs.new do |stub|
42
+ stub.get('/test/request?api_key=abcd&sample=true') { [200, {}, 'OK'] }
43
+ end
44
+ }
45
+ end
46
+ let(:model) { SampleApi.new(config) }
47
+ let(:model2) { Sample2Api.new(config) }
53
48
 
54
49
  describe 'model' do
55
50
  it 'should return string' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Wawer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-23 00:00:00.000000000 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday