api_struct 1.0.0 → 1.0.1

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: e44363911471e7d9ba624a1a2ed6206c11f7b340
4
- data.tar.gz: f6ba8b892e2541d50355a0f5f6f9c544f43e29d8
3
+ metadata.gz: 9b4ddea2489ecf3ef083cd6b4ba06a1e5b1d2fdf
4
+ data.tar.gz: 5d55b25bec067bccf2fe8785badf9770937fc077
5
5
  SHA512:
6
- metadata.gz: de40c7dbef03649602cdb0e7e7f8cb16c289a6f14275b332cb5e4d820c6fa8f08a11b32f6f44ffabbe47f94a6f7fc72129236fa238cee6007425583d34de00c3
7
- data.tar.gz: 34e71ed56918320e1340c97ec7cfa879ba7e0a92dc357867e620a8ad4344dffdf0e2b85bbea4b575acb7484f13bbb0174109c9320deb05486b576c8c3a649c3b
6
+ metadata.gz: e596aef0eb1223dc8477f18822153b92505599d4cd8cc5657d32cdade2a80c0a10febfb1b73e0a33d37b103b653084723c0f633356d032b8a361bb613ee1fe58
7
+ data.tar.gz: 1ac9539e5216151b7cffae6b6973a369a0f095adea730613e9284059c91a2b129f55a42ff4cbad416d43927b51aebb2e9da890ead281be1893f51bd993787fc2
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # v1.0.1 2018-11-27
2
+
3
+ ## Fixed
4
+
5
+ * Parse error for HTML response ([sigra](https://github.com/rubygarage/api_struct/pull/6))
6
+
7
+ # v1.0.0 2018-11-24
8
+
9
+ ## Changed
10
+
11
+ * Updated `dry-monads` dependencies from `0.3.x` to `1.0.x` ([FunkyloverOne](https://github.com/rubygarage/api_struct/pull/5))
12
+
13
+ # v0.0.1 2018-04-06
14
+
15
+ Initial release with core features.
@@ -35,6 +35,8 @@ module ApiStruct
35
35
 
36
36
  def parse_body(b)
37
37
  !b.empty? ? JSON.parse(b, symbolize_names: true) : nil
38
+ rescue JSON::ParserError
39
+ b
38
40
  end
39
41
  end
40
42
  end
@@ -1,3 +1,3 @@
1
1
  module ApiStruct
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -104,6 +104,17 @@ describe ApiStruct::Client do
104
104
  expect(response.failure.status).to eq(404)
105
105
  end
106
106
  end
107
+
108
+ it 'when failed response with html response' do
109
+ VCR.use_cassette('posts/show_failure_html') do
110
+ response = StubClient.new.show(101)
111
+ body = response.failure.body
112
+ expect(response).to be_failure
113
+ expect(response.failure.status).to eq(404)
114
+ expect(body).to be_kind_of(String)
115
+ expect(body).to match(/<body>.+<\/body>/)
116
+ end
117
+ end
107
118
  end
108
119
 
109
120
  context 'PATCH' do
@@ -0,0 +1,67 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://jsonplaceholder.typicode.com/posts/101
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ Connection:
15
+ - close
16
+ Host:
17
+ - jsonplaceholder.typicode.com
18
+ User-Agent:
19
+ - http.rb/3.0.0
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Date:
26
+ - Thu, 18 Jan 2018 19:23:37 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '27'
31
+ Connection:
32
+ - close
33
+ Set-Cookie:
34
+ - __cfduid=dea576b2c58beb4acebfa8cc1b8f3cd731516303417; expires=Fri, 18-Jan-19
35
+ 19:23:37 GMT; path=/; domain=.typicode.com; HttpOnly
36
+ X-Powered-By:
37
+ - Express
38
+ Vary:
39
+ - Origin, Accept-Encoding
40
+ Access-Control-Allow-Credentials:
41
+ - 'true'
42
+ Cache-Control:
43
+ - public, max-age=14400
44
+ Pragma:
45
+ - no-cache
46
+ Expires:
47
+ - Thu, 18 Jan 2018 23:23:37 GMT
48
+ X-Content-Type-Options:
49
+ - nosniff
50
+ Etag:
51
+ - W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
52
+ Via:
53
+ - 1.1 vegur
54
+ Cf-Cache-Status:
55
+ - EXPIRED
56
+ Expect-Ct:
57
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
58
+ Server:
59
+ - cloudflare
60
+ Cf-Ray:
61
+ - 3df3ee046ef84f20-DME
62
+ body:
63
+ encoding: UTF-8
64
+ string: "<body>404. Not Found</body>"
65
+ http_version:
66
+ recorded_at: Thu, 18 Jan 2018 19:23:37 GMT
67
+ recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bezrukavyi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-11-24 00:00:00.000000000 Z
13
+ date: 2018-11-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dry-monads
@@ -212,6 +212,7 @@ files:
212
212
  - ".rspec"
213
213
  - ".rubocop.yml"
214
214
  - ".ruby-version"
215
+ - CHANGELOG.md
215
216
  - Gemfile
216
217
  - Gemfile.lock
217
218
  - LICENSE.txt
@@ -237,6 +238,7 @@ files:
237
238
  - spec/fixtures/cassettes/posts/1.yml
238
239
  - spec/fixtures/cassettes/posts/index_success.yml
239
240
  - spec/fixtures/cassettes/posts/show_failure.yml
241
+ - spec/fixtures/cassettes/posts/show_failure_html.yml
240
242
  - spec/fixtures/cassettes/posts/show_success.yml
241
243
  - spec/fixtures/cassettes/posts/suffix.yml
242
244
  - spec/fixtures/cassettes/posts/update_success.yml