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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d41aefd46847e3024559446254ca04cff1145beb
4
- data.tar.gz: ad97bde45dc46839e592b45c3244b2eae472c2a1
3
+ metadata.gz: 34f096e27c01c96fff3f973ea7cfd24618109eef
4
+ data.tar.gz: b3549d58d0e63214f386d18c9c4bfbb2146d166f
5
5
  SHA512:
6
- metadata.gz: 0f7475d798767b183a715e9952f486818d27fbf4887900e7551c06d062fdf9776b53ce7661668d7b6982a082a34c043ec2bf06a842b6a69a550c731a89cb1e95
7
- data.tar.gz: 652d27ed64b97d9d0d056f6d0891511d32a44b972a13572d0bcbdd71b54801666d29c2558090604aa8280758a14ab31c1f137a0c79e0459b945b85ef18d2cd28
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
- # Send a GET request to http://www.site.com/items
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
- # ...iterate through and print out the `name` attribute for http://www.site.com/items/#
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 HashieMashResponse < Faraday::Response::Middleware
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]
@@ -4,8 +4,7 @@ module Chain
4
4
  def on_complete(env)
5
5
  case env[:status]
6
6
  when 200
7
- body = env[:body].to_s.encode('UTF-8', {invalid: :replace, undef: :replace, replace: '?'})
8
-
7
+ body = env[:body]
9
8
  json = JSON.parse(body)
10
9
  headers = env[:response_headers]
11
10
 
data/lib/chain/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chain
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
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: 2013-11-20 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler