apiture 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apiture.gemspec +1 -1
- data/lib/apiture/request_context.rb +11 -6
- data/lib/apiture/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/jsonplaceholder_createPost.yml +23 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd5118957c985f69767e3b6dfcbd696d0f0b837f
|
4
|
+
data.tar.gz: dcdc6fe5616908d93f80922d72e5dfe60ef4cbd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae248a03fab4bdd17285278e8c532d8e056064a4af85af6d802bef67decec8d6c210771807160940c90df9764df887793cf7b7c7f9e4be9fac9d7ec3e376ac6
|
7
|
+
data.tar.gz: 2dd893a55b9273eb9ca3a4b445ecc6dbad2ca3357b92dd30a4781496e7e67eca2f6f463954729f20fe05a01a8aa7017705bd724beefac661fe58335b46efc2d7
|
data/apiture.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.11.0"
|
22
22
|
spec.add_development_dependency "rake", "~> 11.1.0"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.5.0"
|
24
24
|
spec.add_development_dependency "vcr", "~> 2.9.0"
|
25
25
|
spec.add_development_dependency "webmock", "~> 1.20.0"
|
26
26
|
|
@@ -67,6 +67,7 @@ module Apiture
|
|
67
67
|
headers = env[:request_headers]
|
68
68
|
|
69
69
|
conn = Faraday.new do |faraday|
|
70
|
+
faraday.request :url_encoded
|
70
71
|
faraday.adapter Faraday.default_adapter
|
71
72
|
configure_format_handlers(faraday, headers)
|
72
73
|
end
|
@@ -78,12 +79,16 @@ module Apiture
|
|
78
79
|
conn.__send__(request_method) do |req|
|
79
80
|
req.headers.merge!(headers) if headers
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
82
|
+
if [:get, :head].include?(request_method)
|
83
|
+
req.url env[:url].to_s
|
84
|
+
req.params = env[:params]
|
85
|
+
else
|
86
|
+
req.url env[:url].to_s
|
87
|
+
if body = env[:body]
|
88
|
+
req.body = body
|
89
|
+
elsif !env[:params].empty?
|
90
|
+
req.body = env[:params]
|
91
|
+
end
|
87
92
|
end
|
88
93
|
end
|
89
94
|
end
|
data/lib/apiture/version.rb
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: http://jsonplaceholder.typicode.com/posts
|
5
|
+
uri: http://jsonplaceholder.typicode.com/posts
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
8
|
+
string: body=bar&title=foo&userId=1
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- apiture-rb/0.2.
|
11
|
+
- apiture-rb/0.2.5
|
12
|
+
Content-Type:
|
13
|
+
- application/x-www-form-urlencoded
|
12
14
|
Accept:
|
13
15
|
- application/json
|
14
|
-
Content-Length:
|
15
|
-
- '0'
|
16
16
|
Accept-Encoding:
|
17
17
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
18
|
response:
|
@@ -20,10 +20,17 @@ http_interactions:
|
|
20
20
|
code: 201
|
21
21
|
message: Created
|
22
22
|
headers:
|
23
|
-
|
24
|
-
-
|
23
|
+
Date:
|
24
|
+
- Sat, 10 Sep 2016 04:59:39 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '65'
|
25
29
|
Connection:
|
26
30
|
- keep-alive
|
31
|
+
Set-Cookie:
|
32
|
+
- __cfduid=dc337b8c9e6d528f2a97805892e8c10e11473483579; expires=Sun, 10-Sep-17
|
33
|
+
04:59:39 GMT; path=/; domain=.typicode.com; HttpOnly
|
27
34
|
X-Powered-By:
|
28
35
|
- Express
|
29
36
|
Vary:
|
@@ -38,22 +45,23 @@ http_interactions:
|
|
38
45
|
- "-1"
|
39
46
|
X-Content-Type-Options:
|
40
47
|
- nosniff
|
41
|
-
Content-Type:
|
42
|
-
- application/json; charset=utf-8
|
43
|
-
Content-Length:
|
44
|
-
- '15'
|
45
48
|
Etag:
|
46
|
-
- W/"
|
47
|
-
Date:
|
48
|
-
- Sat, 11 Jun 2016 14:55:02 GMT
|
49
|
+
- W/"41-FMBdqbXVjod9volpL20fFg"
|
49
50
|
Via:
|
50
51
|
- 1.1 vegur
|
52
|
+
Server:
|
53
|
+
- cloudflare-nginx
|
54
|
+
Cf-Ray:
|
55
|
+
- 2e004fd21f163810-ATL
|
51
56
|
body:
|
52
57
|
encoding: UTF-8
|
53
58
|
string: |-
|
54
59
|
{
|
60
|
+
"body": "bar",
|
61
|
+
"title": "foo",
|
62
|
+
"userId": 1,
|
55
63
|
"id": 101
|
56
64
|
}
|
57
65
|
http_version:
|
58
|
-
recorded_at: Sat,
|
66
|
+
recorded_at: Sat, 10 Sep 2016 04:59:39 GMT
|
59
67
|
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Calvin Yu
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.5.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.5.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: vcr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|