atum 0.8.0 → 0.9.0

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: a0b9ba1fb63a78a094276824c8be41879abc25d0
4
- data.tar.gz: 4f0c9b0c7866616dc47f5516f60d7e358ca328e8
3
+ metadata.gz: e3b4f88a40552482c7b7db6d3f8c273ca8dd86e8
4
+ data.tar.gz: 0bf525b21bba1cca79a48cab6e78a06c647bf3c4
5
5
  SHA512:
6
- metadata.gz: a7b7374d8dfb2c130bc86cecbc1b7739a1a20c99ae54043e152cd2babc83a556a29afd450f12da1794f83768ea956a637557ea92f37215d182186cb08d7888df
7
- data.tar.gz: 50a15f227816f55147a512864cdacd6bdca25ce3a7a5cfcd68c8f34919660c052385c482bcd70a8b79f449e8de9825b00550874d797faffbe60c4cc6fe8eed71
6
+ metadata.gz: 4ba17fd52fdf6dda1241ece37036e07904105fbaa682206cfa5c1b620c7e45bd42c6d4695672a18915244934bb388966e5bff91a327d2df91a65388006546bed
7
+ data.tar.gz: 689cef30df036f8368f00e4d877ecac77f6dc266836dfd23cbea8ed165b28e93e15f4e04cf1b2a12192da45d115642ad10431b30c78022b9ad610e1f4dfabda1
data/README.md CHANGED
@@ -24,7 +24,7 @@ in Atum's spec fixtures
24
24
 
25
25
  #### 1. Create a New Gem
26
26
 
27
- To generate a new rubygem client, you can run:
27
+ To generate a new rubygem client (for our ficitional *Fruity* API), you can run:
28
28
 
29
29
  ```
30
30
  $ atum new fruity-api
@@ -32,11 +32,11 @@ $ atum new fruity-api
32
32
 
33
33
  This will does several things:
34
34
 
35
- - Createa a new gem called fruity-api in a `fruity-api` folder in the current
35
+ - Creates a new gem called `fruity-api` in a `fruity-api` folder in the current
36
36
  directory
37
37
 
38
38
  ```
39
- > atum new fruity-api
39
+ $ atum new fruity-api
40
40
  create fruity-api/Gemfile
41
41
  create fruity-api/Rakefile
42
42
  create fruity-api/LICENSE.txt
@@ -74,13 +74,13 @@ If your client needs to pass custom headers with each request these can be
74
74
  specified using `--default-headers or -H`:
75
75
 
76
76
  ```
77
- atum generate -H 'Accept: application/vnd.myapp+json; version=3'
77
+ $ atum generate -H 'Accept: application/vnd.myapp+json; version=3'
78
78
  ```
79
79
 
80
80
  To pass multiple headers, just give multiple strings:
81
81
 
82
82
  ```
83
- atum generate -H 'header1' 'header2' 'header3'
83
+ $ atum generate -H 'header1' 'header2' 'header3'
84
84
  ```
85
85
 
86
86
  You can also define a default\_headers section in your .atum.yml file.
@@ -96,7 +96,7 @@ default_headers:
96
96
  The generated client has [Yard](http://yardoc.org/)-compatible docstrings. You can therefore generate documentation using `yard`:
97
97
 
98
98
  ```
99
- yard doc -m markdown .
99
+ $ yard doc -m markdown .
100
100
  ```
101
101
 
102
102
  This will generate HTML in the `docs` directory. Note that Yard creates an
@@ -131,7 +131,7 @@ Assuming the error response form the server is in JSON format, like:
131
131
  }
132
132
  ```
133
133
 
134
- Atum will return an Atum::Core::ApiError error. You can access the raw hash (unenveloped) via a `.errors` method, otherwise the error message will contain the error's message and a link to the documentation if it exists.
134
+ Atum will return an Atum::Core::ApiError error. You can access the raw hash (unenveloped) via a `.errors` method, by default the error message will contain the error's message and a link to the documentation if it exists.
135
135
 
136
136
 
137
137
 
@@ -18,9 +18,16 @@ module Atum
18
18
  # include:
19
19
  # - default_headers: Optionally, a set of headers to include in every
20
20
  # request made by the client. Default is no custom headers.
21
+ # - http_adapter: Optionally, the http adapter to use; for now we accept
22
+ # adapters according to Faraday's builder:
23
+ # https://github.com/lostisland/faraday/blob/v0.8.9/lib/faraday/builder.rb
24
+ # e.g. http_adapter: [:rack, Rails.application]
21
25
  def initialize(url, link_schema, options = {})
22
26
  root_url, @path_prefix = unpack_url(url)
23
- @connection = Faraday.new(url: root_url)
27
+ http_adapter = options[:http_adapter] || [:net_http]
28
+ @connection = Faraday.new(url: root_url) do |faraday|
29
+ faraday.adapter(*http_adapter)
30
+ end
24
31
  @link_schema = link_schema
25
32
  @headers = options[:default_headers] || {}
26
33
  end
data/lib/atum/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Atum
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -117,4 +117,18 @@ describe 'The Generated Client' do
117
117
  expect(Fruity::VERSION).to eq(version)
118
118
  end
119
119
  end
120
+
121
+ context 'when using a :test http_adapter' do
122
+ before do
123
+ stubs = Faraday::Adapter::Test::Stubs.new do |stub|
124
+ stub.get("#{url}/lemon") { |_| [200, {}, 5] }
125
+ end
126
+ Fruity.connect(url, 'USER', 'PASSWORD',
127
+ http_adapter: [:test, stubs])
128
+ end
129
+
130
+ it 'uses the defined stubs' do
131
+ expect(Fruity.lemon.list).to eq(5)
132
+ end
133
+ end
120
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - isaacseymour
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-10 00:00:00.000000000 Z
12
+ date: 2014-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler