request_via 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/lib/request_via.rb +16 -14
- data/lib/request_via/func.rb +6 -0
- data/lib/request_via/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4966442b32fe09b091c1ba940658f3ae1330210
|
4
|
+
data.tar.gz: d28c20e0ad6709eaa801f7751a3d2947d3e65c2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 470c31a0b38d42987f41eb9cbeff68f333ccdc875efa77098ec7a7fc3e544baa9476471ab7fc52d5b31070726d8d896438d7fedc865b33a667a3a8285afc058a
|
7
|
+
data.tar.gz: a78cf82f0077abcbd8d312072c5d0a26c32e90d5ee228aefe25dc216ebf2b4e81d3da3403828a83e6efe67bdb8763d154268fecc9eb5e96ece9eb55793d33b2d
|
data/README.md
CHANGED
@@ -63,24 +63,29 @@ RequestVia::Get.('example.com', params: { foo: 'bar' })
|
|
63
63
|
# Request with headers
|
64
64
|
RequestVia::Get.('example.com/foo', headers: { 'X-Requested-With': 'RequestVia gem' })
|
65
65
|
|
66
|
-
# Return the response and request objects
|
66
|
+
# Return the response and request objects
|
67
67
|
response, request = RequestVia::Get.('example.com/foo', response_and_request: true)
|
68
|
+
|
69
|
+
# Request with the reversed arguments order
|
70
|
+
%w[
|
71
|
+
example.com/foo example.com/bar
|
72
|
+
].map &RequestVia::GetR.(headers: { 'X-Requested-With': 'RequestVia gem' })
|
68
73
|
```
|
69
74
|
|
70
75
|
Supported HTTP methods.
|
71
76
|
(**NOTE:** you can use all arguments of previous examples)
|
72
77
|
```ruby
|
73
|
-
RequestVia::Post.()
|
78
|
+
RequestVia::Post.() # RequestVia::PostR.()
|
74
79
|
|
75
|
-
RequestVia::Put.()
|
80
|
+
RequestVia::Put.() # RequestVia::PutR.()
|
76
81
|
|
77
|
-
RequestVia::Delete.()
|
82
|
+
RequestVia::Delete.() # RequestVia::DeteteR.()
|
78
83
|
|
79
|
-
RequestVia::Options.()
|
84
|
+
RequestVia::Options.() # RequestVia::OptionsR.()
|
80
85
|
|
81
|
-
RequestVia::Trace.()
|
86
|
+
RequestVia::Trace.() # RequestVia::TraceR.()
|
82
87
|
|
83
|
-
RequestVia::Patch.()
|
88
|
+
RequestVia::Patch.() # RequestVia::PatchR.()
|
84
89
|
```
|
85
90
|
|
86
91
|
Making a HTTPS request.
|
data/lib/request_via.rb
CHANGED
@@ -8,19 +8,21 @@ require "request_via/http_client"
|
|
8
8
|
require "request_via/func"
|
9
9
|
|
10
10
|
module RequestVia
|
11
|
-
Get
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Put = Func::FetchStrategyTo.(Net::HTTP::Put).freeze
|
18
|
-
|
19
|
-
Delete = Func::FetchStrategyTo.(Net::HTTP::Delete).freeze
|
20
|
-
|
11
|
+
Get = Func::FetchStrategyTo.(Net::HTTP::Get).freeze
|
12
|
+
Head = Func::FetchStrategyTo.(Net::HTTP::Head).freeze
|
13
|
+
Post = Func::FetchStrategyTo.(Net::HTTP::Post).freeze
|
14
|
+
Put = Func::FetchStrategyTo.(Net::HTTP::Put).freeze
|
15
|
+
Delete = Func::FetchStrategyTo.(Net::HTTP::Delete).freeze
|
21
16
|
Options = Func::FetchStrategyTo.(Net::HTTP::Options).freeze
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
Trace = Func::FetchStrategyTo.(Net::HTTP::Trace).freeze
|
18
|
+
Patch = Func::FetchStrategyTo.(Net::HTTP::Patch).freeze
|
19
|
+
|
20
|
+
GetR = Func::ReverseRequestArgsTo.(Get).freeze
|
21
|
+
HeadR = Func::ReverseRequestArgsTo.(Head).freeze
|
22
|
+
PostR = Func::ReverseRequestArgsTo.(Post).freeze
|
23
|
+
PutR = Func::ReverseRequestArgsTo.(Put).freeze
|
24
|
+
DeleteR = Func::ReverseRequestArgsTo.(Delete).freeze
|
25
|
+
OptionsR = Func::ReverseRequestArgsTo.(Options).freeze
|
26
|
+
TraceR = Func::ReverseRequestArgsTo.(Trace).freeze
|
27
|
+
PatchR = Func::ReverseRequestArgsTo.(Patch).freeze
|
26
28
|
end
|
data/lib/request_via/func.rb
CHANGED
data/lib/request_via/version.rb
CHANGED