chain 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 +4 -4
- data/README.md +6 -6
- data/lib/chain/middleware/hashie_mash_response.rb +1 -2
- data/lib/chain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34f096e27c01c96fff3f973ea7cfd24618109eef
|
4
|
+
data.tar.gz: b3549d58d0e63214f386d18c9c4bfbb2146d166f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26d16b82f63db70beec56e8c17614e2c1d296a359984de7b4bdcc5e77040e43d9a33dbf90c764ab2e665f77a7feea586c7deb0d3f5acf3bcbce09accc395ac92
|
7
|
+
data.tar.gz: 526a7c303573b8af6afc18e1e3bd2bdb6be919f62dc68d87d5771c0c06536579095b06762f3f9f7d160f8ad73b82bbdd652fd56bb77f9900deacb1564d94439d
|
data/README.md
CHANGED
@@ -22,16 +22,16 @@ Simply instantiate the `Url` class and then chain together a series of methods t
|
|
22
22
|
=> "..."
|
23
23
|
```
|
24
24
|
|
25
|
-
This opens up all sorts of clever ways to iterate through an endpoint
|
25
|
+
This opens up all sorts of clever ways to iterate through an endpoint. You can reuse objects and iterate through them multiple times.
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
#
|
29
|
-
items = site.items
|
28
|
+
# Create a Chain::Url instance that is associated with http://www.site.com/items, but do not fetch it yet.
|
29
|
+
items = site.items
|
30
30
|
|
31
31
|
# Assuming that /items returns a JSON object containing a list of items in the `data` attribute...
|
32
|
-
items.data.each do |item|
|
32
|
+
items._fetch.data.each do |item|
|
33
33
|
|
34
|
-
# ...
|
34
|
+
# ...re-use the "items" object to send a request to items/# and print out the `name` attribute
|
35
35
|
puts items[item.id]._fetch.name
|
36
36
|
end
|
37
37
|
```
|
@@ -81,7 +81,7 @@ end
|
|
81
81
|
Writing your own middleware is fairly easy. Chain uses something along the lines of:
|
82
82
|
|
83
83
|
```ruby
|
84
|
-
class
|
84
|
+
class MyResponseMiddleWare < Faraday::Response::Middleware
|
85
85
|
def on_complete(env)
|
86
86
|
body = JSON.parse(env[:body])
|
87
87
|
headers = env[:response_headers]
|
data/lib/chain/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chain
|
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
|
- Stefan Novak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|