procore 0.7.3 → 0.8.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
  SHA256:
3
- metadata.gz: 88538f8106ff12e1532f8b3b2837e506c336857564b05529c1013e1bb849756a
4
- data.tar.gz: 824483dff32962cc8d39e69754e2a3e8e6bfbc159e840bd3a3ef77a586dff3d6
3
+ metadata.gz: de9db8ec73ee357db98a0f91e185181dd0974b17984876a9fb6fbda80f7d43ea
4
+ data.tar.gz: 1dfba18ed4f52b11111cd46ce565d247bdf0dfd893f6adac805d15f8ba7ea26a
5
5
  SHA512:
6
- metadata.gz: 4c7d776773d2111c0b6db558c2ea13703010115a0eb22481e7d8dfd00429046ef3b04ebdf9eea978ff79c9d4db415812c769eee58e82ae85e7401e8c925df25d
7
- data.tar.gz: 9f5ccc7e220d19c4edf36c7fd4724df284d77dad43c7547f454d241f659b14d702fa4f0ad68bb5621a4d309b34219a10cb4e85c44a63b08e3874b0d98b411586
6
+ metadata.gz: 72d12d650d80082e301964204f37d78a95d947a71b7a938d456013f081b0f5d8079226aca82df8d38790483f9f9ce0d2f0ecfbcfbff560207084aa10ca02e59b
7
+ data.tar.gz: cfeda2877fd80e28af9e48f2dfd26d7f8975b9c5d52e3c7b89af84acafe72e20e31c8cedc61fe8a19735c2e9cc70f703a6d5de54aaf487fca0ea40979b924035
data/.rubocop.yml CHANGED
@@ -372,9 +372,15 @@ Style/TrailingCommaInArguments:
372
372
  - no_comma
373
373
  Enabled: true
374
374
 
375
- Style/TrailingCommaInLiteral:
376
- Description: 'Checks for trailing comma in array and hash literals.'
377
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
375
+ Style/TrailingCommaInArrayLiteral:
376
+ EnforcedStyleForMultiline: comma
377
+ SupportedStylesForMultiline:
378
+ - comma
379
+ - consistent_comma
380
+ - no_comma
381
+ Enabled: true
382
+
383
+ Style/TrailingCommaInHashLiteral:
378
384
  EnforcedStyleForMultiline: comma
379
385
  SupportedStylesForMultiline:
380
386
  - comma
@@ -557,13 +563,6 @@ Lint/UnderscorePrefixedVariableName:
557
563
  Description: 'Do not use prefix `_` for a variable that is used.'
558
564
  Enabled: false
559
565
 
560
- Lint/UnneededDisable:
561
- Description: >-
562
- Checks for rubocop:disable comments that can be removed.
563
- Note: this cop is not disabled when disabling all cops.
564
- It must be explicitly disabled.
565
- Enabled: false
566
-
567
566
  Lint/Void:
568
567
  Description: 'Possible use of operator/literal/variable in void context.'
569
568
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.8.1 (April 13, 2018)
4
+
5
+ * Fix rubocop
6
+
7
+ *Michael Stock/Jason Gittler*
8
+
9
+ ## 0.8.0 (April 13, 2018)
10
+
11
+ * Move all request methods to use keyword arguments
12
+
13
+ *Michael Stock/Jason Gittler*
14
+
3
15
  ## 0.7.3 (March 1, 2018)
4
16
 
5
17
  * Add 403 responses as Procore::ForbiddenError
data/README.md CHANGED
@@ -25,11 +25,11 @@ The Client class exposes `#get`, `#post`, `#put`, `#patch` and `#delete` methods
25
25
  to you.
26
26
 
27
27
  ```ruby
28
- get(path, query = {})
29
- post(path, body = {}, options = {})
30
- put(path, body = {}, options = {})
31
- patch(path, body = {}, options = {})
32
- delete(path, query = {})
28
+ get(path, query: {})
29
+ post(path, body: {}, options: {})
30
+ put(path, body: {}, options: {})
31
+ patch(path, body: {}, options: {})
32
+ delete(path, query: {})
33
33
  ```
34
34
 
35
35
  All paths are relative - the gem will handle expanding `client.get("me")` to
@@ -226,7 +226,7 @@ You can pass a `per_page` query parameter in your request to change the page
226
226
  size. The pagination links will update to reflect that change.
227
227
 
228
228
  ```
229
- first_page = client.get("projects", per_page: 250)
229
+ first_page = client.get("projects", query: { per_page: 250 })
230
230
 
231
231
  puts first_page.pagination
232
232
  {
@@ -376,7 +376,7 @@ end
376
376
  # Somewhere else in the application
377
377
  class ProjectsController
378
378
  def index
379
- @projects = client.get("projects", company_id: params[:company_id])
379
+ @projects = client.get("projects", query: { company_id: params[:company_id] })
380
380
  end
381
381
 
382
382
  private
@@ -12,12 +12,13 @@ module Procore
12
12
  module Requestable
13
13
  # @param path [String] URL path
14
14
  # @param query [Hash] Query options to pass along with the request
15
+ # @option options [Hash] :company_id
15
16
  #
16
17
  # @example Usage
17
- # client.get("my_open_items", per_page: 5, filter: {})
18
+ # client.get("my_open_items", query: { per_page: 5, filter: {} })
18
19
  #
19
20
  # @return [Response]
20
- def get(path, query = {})
21
+ def get(path, query: {}, options: {})
21
22
  Util.log_info(
22
23
  "API Request Initiated",
23
24
  path: "#{base_api_path}/#{path}",
@@ -29,7 +30,7 @@ module Procore
29
30
  RestClient::Request.execute(
30
31
  method: :get,
31
32
  url: "#{base_api_path}/#{path}",
32
- headers: headers.merge(params: query),
33
+ headers: headers(options).merge(params: query),
33
34
  timeout: Procore.configuration.timeout,
34
35
  )
35
36
  end
@@ -38,14 +39,17 @@ module Procore
38
39
  # @param path [String] URL path
39
40
  # @param body [Hash] Body parameters to send with the request
40
41
  # @param options [Hash} Extra request options
41
- # TODO Add description for idempotency key
42
- # @option options [String] :idempotency_token
42
+ # @option options [String] :idempotency_token | :company_id
43
43
  #
44
44
  # @example Usage
45
- # client.post("users", { name: "New User" }, { idempotency_token: "key" })
45
+ # client.post(
46
+ # "users",
47
+ # body: { name: "New User" },
48
+ # options: { idempotency_token: "key", company_id: 1 },
49
+ # )
46
50
  #
47
51
  # @return [Response]
48
- def post(path, body = {}, options = {})
52
+ def post(path, body: {}, options: {})
49
53
  Util.log_info(
50
54
  "API Request Initiated",
51
55
  path: "#{base_api_path}/#{path}",
@@ -67,13 +71,13 @@ module Procore
67
71
  # @param path [String] URL path
68
72
  # @param body [Hash] Body parameters to send with the request
69
73
  # @param options [Hash} Extra request options
70
- # TODO Add description for idempotency key
74
+ # @option options [String] :idempotency_token | :company_id
71
75
  #
72
76
  # @example Usage
73
- # client.put("dashboards/1/users", [1,2,3])
77
+ # client.put("dashboards/1/users", body: [1,2,3], options: { company_id: 1 })
74
78
  #
75
79
  # @return [Response]
76
- def put(path, body = {}, options = {})
80
+ def put(path, body: {}, options: {})
77
81
  Util.log_info(
78
82
  "API Request Initiated",
79
83
  path: "#{base_api_path}/#{path}",
@@ -95,14 +99,17 @@ module Procore
95
99
  # @param path [String] URL path
96
100
  # @param body [Hash] Body parameters to send with the request
97
101
  # @param options [Hash} Extra request options
98
- # TODO Add description for idempotency token
99
- # @option options [String] :idempotency_token
102
+ # @option options [String] :idempotency_token | :company_id
100
103
  #
101
104
  # @example Usage
102
- # client.patch("users/1", { name: "Updated" }, { idempotency_token: "key" })
105
+ # client.patch(
106
+ # "users/1",
107
+ # body: { name: "Updated" },
108
+ # options: { idempotency_token: "key", company_id: 1 },
109
+ # )
103
110
  #
104
111
  # @return [Response]
105
- def patch(path, body = {}, options = {})
112
+ def patch(path, body: {}, options: {})
106
113
  Util.log_info(
107
114
  "API Request Initiated",
108
115
  path: "#{base_api_path}/#{path}",
@@ -123,16 +130,18 @@ module Procore
123
130
 
124
131
  # @param path [String] URL path
125
132
  # @param query [Hash] Query options to pass along with the request
133
+ # @option options [String] :company_id
126
134
  #
127
135
  # @example Usage
128
- # client.delete("users/1")
136
+ # client.delete("users/1", query: {}, options: {})
129
137
  #
130
138
  # @return [Response]
131
- def delete(path, query = {}, _options = {})
139
+ def delete(path, query: {}, options: {})
132
140
  Util.log_info(
133
141
  "API Request Initiated",
134
142
  path: "#{base_api_path}/#{path}",
135
143
  method: "DELETE",
144
+ headers: headers(options),
136
145
  query: query.to_s,
137
146
  )
138
147
 
@@ -250,6 +259,10 @@ module Procore
250
259
  if options[:idempotency_token]
251
260
  headers["Idempotency-Token"] = options[:idempotency_token]
252
261
  end
262
+
263
+ if options[:company_id]
264
+ headers["procore-company-id"] = options[:company_id]
265
+ end
253
266
  end
254
267
  end
255
268
 
@@ -1,3 +1,5 @@
1
+ require "active_support/hash_with_indifferent_access"
2
+
1
3
  module Procore
2
4
  # Wrapper class for a response received from the Procore API. Stores the
3
5
  # body, code, headers, and pagination information.
@@ -1,3 +1,3 @@
1
1
  module Procore
2
- VERSION = "0.7.3".freeze
2
+ VERSION = "0.8.1".freeze
3
3
  end
data/procore.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "procore/version"
6
6
 
@@ -34,6 +34,7 @@ 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 "activesupport", "> 2.4"
37
38
  spec.add_dependency "oauth2", "~> 1.4"
38
39
  spec.add_dependency "rest-client", "~> 2.0.0"
39
40
  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.3
4
+ version: 0.8.1
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-03-02 00:00:00.000000000 Z
11
+ date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: activesupport
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">"
172
+ - !ruby/object:Gem::Version
173
+ version: '2.4'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">"
179
+ - !ruby/object:Gem::Version
180
+ version: '2.4'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: oauth2
169
183
  requirement: !ruby/object:Gem::Requirement