Skip to content

Commit

Permalink
Update Grants.rb add Patch (#464)
Browse files Browse the repository at this point in the history
* Update Grants.rb add Patch

Add Patch operation, as it is needed when doing Update Grant

* Update grants_spec to use patch

Test should use patch instead of put for grants update
  • Loading branch information
atejada committed Feb 21, 2024
1 parent 0be4370 commit 7c619b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/nylas/resources/grants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Grants < Resource
include ApiOperations::Get
include ApiOperations::Put
include ApiOperations::Delete
include ApiOperations::Patch

# Return all grants.
#
Expand Down Expand Up @@ -37,7 +38,7 @@ def find(grant_id:)
# @param request_body [Hash] The values to update the grant with
# @return [Array(Hash, String)] The updated grant and API Request ID.
def update(grant_id:, request_body:)
put(
patch(
path: "#{api_uri}/v3/grants/#{grant_id}",
request_body: request_body
)
Expand Down
2 changes: 1 addition & 1 deletion spec/nylas/resources/grants_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
scope: %w[https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile]
}
path = "#{api_uri}/v3/grants/#{grant_id}"
allow(grants).to receive(:put)
allow(grants).to receive(:patch)
.with(path: path, request_body: request_body)
.and_return(response)

Expand Down

0 comments on commit 7c619b5

Please sign in to comment.