procore 0.6.9 → 0.7.0
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/procore/requestable.rb +34 -21
- data/lib/procore/version.rb +1 -1
- data/procore.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba26de8f801db077402e6119b3d45bc04c097a6ac5f25c2a686c2ece6f1660f2
|
4
|
+
data.tar.gz: 65020be1331a41550388c1ad39bee27b91d1a09bcc1ae346273d5b1a8f1034ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c3671f731c30b852a8daa6fe4fde8af9ccf19bdf52962485a06ac1182dc937d1a8737f23bb7254ab8244135efecc0432f9157311ff47b0d6d95a6da6252ca5
|
7
|
+
data.tar.gz: 62a695f1b3f1f53c40182eb637ca59839b1f8045c260ab937abc2cae4d6d431b1ddda685d349fb3091f804ef851b88a65f33e8aaa313562f3dc5ecef67763d6a
|
data/CHANGELOG.md
CHANGED
data/lib/procore/requestable.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "rest-client"
|
2
2
|
|
3
3
|
module Procore
|
4
4
|
# Module which defines HTTP verbs GET, POST, PUT, PATCH and DELETE. Is
|
@@ -26,10 +26,10 @@ module Procore
|
|
26
26
|
)
|
27
27
|
|
28
28
|
with_response_handling do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
headers: headers,
|
29
|
+
RestClient::Request.execute(
|
30
|
+
method: :get,
|
31
|
+
url: "#{base_api_path}/#{path}",
|
32
|
+
headers: headers.merge(params: query),
|
33
33
|
timeout: Procore.configuration.timeout,
|
34
34
|
)
|
35
35
|
end
|
@@ -54,9 +54,10 @@ module Procore
|
|
54
54
|
)
|
55
55
|
|
56
56
|
with_response_handling do
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
RestClient::Request.execute(
|
58
|
+
method: :post,
|
59
|
+
url: "#{base_api_path}/#{path}",
|
60
|
+
payload: payload(body),
|
60
61
|
headers: headers(options),
|
61
62
|
timeout: Procore.configuration.timeout,
|
62
63
|
)
|
@@ -81,9 +82,10 @@ module Procore
|
|
81
82
|
)
|
82
83
|
|
83
84
|
with_response_handling do
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
RestClient::Request.execute(
|
86
|
+
method: :put,
|
87
|
+
url: "#{base_api_path}/#{path}",
|
88
|
+
payload: payload(body),
|
87
89
|
headers: headers(options),
|
88
90
|
timeout: Procore.configuration.timeout,
|
89
91
|
)
|
@@ -109,9 +111,10 @@ module Procore
|
|
109
111
|
)
|
110
112
|
|
111
113
|
with_response_handling do
|
112
|
-
|
113
|
-
|
114
|
-
|
114
|
+
RestClient::Request.execute(
|
115
|
+
method: :patch,
|
116
|
+
url: "#{base_api_path}/#{path}",
|
117
|
+
payload: payload(body),
|
115
118
|
headers: headers(options),
|
116
119
|
timeout: Procore.configuration.timeout,
|
117
120
|
)
|
@@ -134,10 +137,10 @@ module Procore
|
|
134
137
|
)
|
135
138
|
|
136
139
|
with_response_handling do
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
headers: headers,
|
140
|
+
RestClient::Request.execute(
|
141
|
+
method: :delete,
|
142
|
+
url: "#{base_api_path}/#{path}",
|
143
|
+
headers: headers.merge(params: query),
|
141
144
|
timeout: Procore.configuration.timeout,
|
142
145
|
)
|
143
146
|
end
|
@@ -151,7 +154,7 @@ module Procore
|
|
151
154
|
|
152
155
|
begin
|
153
156
|
result = yield
|
154
|
-
rescue Timeout
|
157
|
+
rescue RestClient::Exceptions::Timeout, Errno::ECONNREFUSED => e
|
155
158
|
if retries <= Procore.configuration.max_retries
|
156
159
|
retries += 1
|
157
160
|
sleep 1.5**retries
|
@@ -164,6 +167,8 @@ module Procore
|
|
164
167
|
"values.",
|
165
168
|
), e
|
166
169
|
end
|
170
|
+
rescue RestClient::ExceptionWithResponse => e
|
171
|
+
result = e.response
|
167
172
|
end
|
168
173
|
|
169
174
|
response = Procore::Response.new(
|
@@ -177,7 +182,7 @@ module Procore
|
|
177
182
|
when 200..299
|
178
183
|
Util.log_info(
|
179
184
|
"API Request Finished ",
|
180
|
-
path: result.request.
|
185
|
+
path: result.request.url,
|
181
186
|
status: result.code.to_s,
|
182
187
|
duration: "#{((Time.now - request_start_time) * 1000).round(0)}ms",
|
183
188
|
request_id: result.headers["x-request-id"],
|
@@ -185,7 +190,7 @@ module Procore
|
|
185
190
|
else
|
186
191
|
Util.log_error(
|
187
192
|
"API Request Failed",
|
188
|
-
path: result.request.
|
193
|
+
path: result.request.url,
|
189
194
|
status: result.code.to_s,
|
190
195
|
duration: "#{((Time.now - request_start_time) * 1000).round(0)}ms",
|
191
196
|
request_id: result.headers["x-request-id"],
|
@@ -241,5 +246,13 @@ module Procore
|
|
241
246
|
end
|
242
247
|
end
|
243
248
|
end
|
249
|
+
|
250
|
+
def payload(body)
|
251
|
+
multipart?(body) ? body : body.to_json
|
252
|
+
end
|
253
|
+
|
254
|
+
def multipart?(body)
|
255
|
+
RestClient::Payload::has_file?(body)
|
256
|
+
end
|
244
257
|
end
|
245
258
|
end
|
data/lib/procore/version.rb
CHANGED
data/procore.gemspec
CHANGED
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "sqlite3"
|
35
35
|
spec.add_development_dependency "webmock"
|
36
36
|
|
37
|
-
spec.add_dependency "httparty", "~> 0.16"
|
38
37
|
spec.add_dependency "oauth2", "~> 1.4"
|
38
|
+
spec.add_dependency "rest-client", "~> 2.0.0"
|
39
39
|
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.
|
4
|
+
version: 0.7.0
|
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-
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -165,33 +165,33 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: oauth2
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '1.4'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '1.4'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: rest-client
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 2.0.0
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 2.0.0
|
195
195
|
description: Procore Ruby Gem
|
196
196
|
email:
|
197
197
|
- opensource@procore.comm
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
249
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.7.
|
250
|
+
rubygems_version: 2.7.6
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: Procore Ruby Gem
|