procore 0.7.1 → 0.7.2

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
  SHA256:
3
- metadata.gz: e0f86f56ddb0bdf75c831f76f515f2e67dd757ec9ba68e3b618b83487b0b1348
4
- data.tar.gz: 3462df2033ace06a83e549bddc759f9b40b62f75539dee91539c2bef4ee8a2ba
3
+ metadata.gz: ae6c0226d347ed0e22d39b703526fdcb14d3da1b98c30ebf1ab2f73b1b9a671b
4
+ data.tar.gz: 237380d9cba94cc73f07193deb05c6a029af0dbb22a772cf3a838d723d9e6c60
5
5
  SHA512:
6
- metadata.gz: fc52f72df78d95a21dce709d015344572a71bfe96e6d712116a99eec930e51ce47c5fb5bfdb22be9d7a1c269d1dc272a024a898762f68c7113ea0de1448a84a9
7
- data.tar.gz: 6e9f823921f9f595045a4df890a720af9c5b9fee16eb2c6c5d343a0932143e79f64dafb4d1c1a79576564987fc32be45166f57e137c03ea6c80fee7ce1088697
6
+ metadata.gz: 28d6ec525a47761dd88ebb8f687bb229df90c4b90748520cac67245e7b96ba39bdb75b6d611cdbcda849b8402e7f82fe0d20c8a191a8521161daa32001cc9d29
7
+ data.tar.gz: db828e83fe25a0b80a262abe3e853f148e567048106871e5ea68c0c9bda43f4065b69208818e58fbfa719530d0c0ebdcb56eb69f69ac6310aecc1e2057b1bbab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.7.2 (February 28, 2018)
4
+
5
+ * Add 400 responses as Procore::InvalidRequestError
6
+
7
+ *Michael Stock*
8
+
9
+ * Add request_body to Procore::Response for debugging
10
+
11
+ *Michael Stock*
12
+
3
13
  ## 0.7.1 (February 22, 2018)
4
14
 
5
15
  * Fix redis store guard clause
@@ -53,7 +53,7 @@ module Procore
53
53
  body: body.to_s,
54
54
  )
55
55
 
56
- with_response_handling do
56
+ with_response_handling(request_body: body) do
57
57
  RestClient::Request.execute(
58
58
  method: :post,
59
59
  url: "#{base_api_path}/#{path}",
@@ -81,7 +81,7 @@ module Procore
81
81
  body: body.to_s,
82
82
  )
83
83
 
84
- with_response_handling do
84
+ with_response_handling(request_body: body) do
85
85
  RestClient::Request.execute(
86
86
  method: :put,
87
87
  url: "#{base_api_path}/#{path}",
@@ -110,7 +110,7 @@ module Procore
110
110
  body: body.to_s,
111
111
  )
112
112
 
113
- with_response_handling do
113
+ with_response_handling(request_body: body) do
114
114
  RestClient::Request.execute(
115
115
  method: :patch,
116
116
  url: "#{base_api_path}/#{path}",
@@ -148,7 +148,7 @@ module Procore
148
148
 
149
149
  private
150
150
 
151
- def with_response_handling
151
+ def with_response_handling(request_body: nil)
152
152
  request_start_time = Time.now
153
153
  retries = 0
154
154
 
@@ -176,6 +176,7 @@ module Procore
176
176
  headers: result.headers,
177
177
  code: result.code,
178
178
  request: result.request,
179
+ request_body: request_body,
179
180
  )
180
181
 
181
182
  case result.code
@@ -213,7 +214,7 @@ module Procore
213
214
  "exist.",
214
215
  response: response,
215
216
  )
216
- when 422
217
+ when 400, 422
217
218
  raise Procore::InvalidRequestError.new(
218
219
  "Bad Request.",
219
220
  response: response,
@@ -248,7 +249,11 @@ module Procore
248
249
  end
249
250
 
250
251
  def payload(body)
251
- multipart?(body) ? body : body.to_json
252
+ if multipart?(body)
253
+ body
254
+ else
255
+ body.to_json
256
+ end
252
257
  end
253
258
 
254
259
  def multipart?(body)
@@ -43,13 +43,14 @@ module Procore
43
43
  # @return [Integer] Status Code returned from Procore API.
44
44
  # @!attribute [r] pagination
45
45
  # @return [Hash<Symbol, String>] Pagination URLs
46
- attr_reader :headers, :code, :pagination, :request
46
+ attr_reader :headers, :code, :pagination, :request, :request_body
47
47
 
48
- def initialize(body:, headers:, code:, request:)
48
+ def initialize(body:, headers:, code:, request:, request_body:)
49
49
  @code = code
50
50
  @headers = headers
51
51
  @pagination = parse_pagination
52
52
  @request = request
53
+ @request_body = request_body
53
54
  @raw_body = !body.to_s.empty? ? body : "{}".to_json
54
55
  end
55
56
 
@@ -1,3 +1,3 @@
1
1
  module Procore
2
- VERSION = "0.7.1".freeze
2
+ VERSION = "0.7.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Procore Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-22 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack