blanket_wrapper 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebd3e2f8d83cd5f3b5aed5c3ac4577a77a0491f6
4
- data.tar.gz: 1c5ae3fc5e74ad23f17f48a6c1e299bcf2ad048f
3
+ metadata.gz: 8252184153a5c8734c3512c6ff6eea2e5a89d077
4
+ data.tar.gz: c8562c25b4f679bbc6a2dda18dab57cf5e340d29
5
5
  SHA512:
6
- metadata.gz: 74bb5579826a56156a278ca20f1166e14a7bb77978119abd5684546f19865ffde335b330c9dbab9f17c902dd0d9bf53bb87854d6e43bd65a0ce7aa4992b8affc
7
- data.tar.gz: 217dc68aa621accb5863f03b5e3b6e7aeef3b63e30285637193d3d4673309bfdd92055c6ab5afe994a9ac209f15c68a0bdd958f70c2c71bbe7de107d3b9d206e
6
+ metadata.gz: 6a2729a2ed218ccf1302a3202401f503ee9609d30424e035b52b9714f662634bff0781d29d70e43d1ecebf4fa60026f197f0793099054442cdb14d4c425c1ddb
7
+ data.tar.gz: a39dedce0183fcf27d055944eb4e6d3276677c3a79c40df1766ff7e55274e10c853877bcb388ac26858eb3615d8a58eab7ac5e6407103994d25ab0bb394bb7df
data/README.md CHANGED
@@ -85,6 +85,13 @@ github.users('inf0rmer').repos
85
85
 
86
86
  The final `get` method performs a GET HTTP request. You can also use it to append a final part to your request, so you can write something like:
87
87
 
88
+ As this magic works using `method_missingp`, you can `send` slashed uri parts to the wrapper and it will play nicely. This is especially usefull when APIs give you URLs:
89
+ ```ruby
90
+ github.get('users/inf0rmer/repos')
91
+ # or, if you don't wnat to perform the request yet, or have to append more parts to the uri
92
+ github.send('users/inf0rmer').repos#.get
93
+ ```
94
+
88
95
  ```ruby
89
96
  github = Blanket.wrap("https://api.github.com")
90
97
  github.users.get('inf0rmer')
@@ -1,4 +1,4 @@
1
1
  module Blanket
2
2
  # Current gem version
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
@@ -92,7 +92,7 @@ module Blanket
92
92
  end
93
93
 
94
94
  def uri_from_parts(parts)
95
- ([@base_uri] + parts).compact.join('/')
95
+ File.join @base_uri, *parts.compact.map(&:to_s)
96
96
  end
97
97
  end
98
98
  end
@@ -16,6 +16,14 @@ describe "Blanket::Wrapper" do
16
16
  expect(HTTParty).to have_received(:get).with("http://api.example.org/videos", anything())
17
17
  end
18
18
 
19
+ it 'allows full paths for uri construction' do
20
+ allow(HTTParty).to receive(:get) { StubbedResponse.new }
21
+
22
+ api.get('flexible/path')
23
+
24
+ expect(HTTParty).to have_received(:get).with("http://api.example.org/flexible/path", anything())
25
+ end
26
+
19
27
  describe "Response" do
20
28
  before :each do
21
29
  stub_request(:get, "http://api.example.org/users")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blanket_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Abrantes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-30 00:00:00.000000000 Z
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty