restafari 0.7.4 → 0.7.5
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.
- data/lib/restafari/action.rb +1 -0
- data/lib/restafari/version.rb +1 -1
- data/spec/restafari/action_spec.rb +10 -0
- metadata +4 -4
data/lib/restafari/action.rb
CHANGED
@@ -45,6 +45,7 @@ module Restafari
|
|
45
45
|
conn = Faraday.new(url: Restafari.config.url)
|
46
46
|
Restafari.config.run_before_request_hook(params)
|
47
47
|
result = conn.send(Restafari.config.http_method, path, params) do |req|
|
48
|
+
req.headers.update(params[:headers]) if params.has_key?(:headers)
|
48
49
|
@req = req
|
49
50
|
yield req if block_given?
|
50
51
|
end
|
data/lib/restafari/version.rb
CHANGED
@@ -71,8 +71,18 @@ describe Restafari::Action do
|
|
71
71
|
@req = req
|
72
72
|
end
|
73
73
|
@req.should be_kind_of(Faraday::Request)
|
74
|
+
end
|
74
75
|
|
76
|
+
it "should allow passing headers to actions" do
|
77
|
+
class SomeAction
|
78
|
+
include Restafari::Action
|
79
|
+
action :some_method
|
80
|
+
end
|
75
81
|
|
82
|
+
SomeAction.some_method(headers:{cookie:"aaa"}) do |req|
|
83
|
+
@headers = req.headers
|
84
|
+
end
|
85
|
+
@headers[:cookie].should eq "aaa"
|
76
86
|
end
|
77
87
|
|
78
88
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restafari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 5
|
10
|
+
version: 0.7.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Danni Friedland
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-08-
|
18
|
+
date: 2012-08-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: faraday
|