microslop_one_drive 5.1.0 → 5.1.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: 3888f96cecbe9314e50eb6808fbd53af0ec0115905ac06c9c034abbee0871cf9
4
- data.tar.gz: 9efebc0e59d585e66e8bc7778f593d4e299dafe37e7497319fb71a4bb928a8a7
3
+ metadata.gz: 1260d248788e7480366222b43716bdcfd51694eb2da87d192c533bcdc064401f
4
+ data.tar.gz: 8bfab49dad19e8a720856977873f1f4ccf7aef70716dfe5e104dc0e7038837b3
5
5
  SHA512:
6
- metadata.gz: bc24edeb9829b2c982d6c629f82bd1d6a884fe90476bfa8cc9c49948b30c9f25bde0fe3bda934607aab8f1f64d993e3da7d68e8f363849a4a29af4e026b10b77
7
- data.tar.gz: 6275971239665720766eff7629b3bfc3b375844a5f3f15f1b6c8c29569590730f3a8410c17bbdfbdd18ea54ae9cc53766ba055b97c7479ac3f6428db22b7ede5
6
+ metadata.gz: 75d5f9f86a4a9d31ce34720517e2cb72d735cdcb4ab5c04751c48229549b4f7e1e495006135b38823c104b95353a79a1b156ab618de176f6a25fc0b1ffd0736b
7
+ data.tar.gz: ec1b7ccfa3bd4fca6212fab4f79ea190b975930f41475457f3b8e35c1154dd06467db57fbc5e9224c059aff20466336ae129adf31f305d840e5aa34e9fe7eaf5
@@ -3,6 +3,7 @@ require "json"
3
3
  module MicroslopOneDrive
4
4
  class Client
5
5
  BASE_URL = "https://graph.microsoft.com/v1.0".freeze
6
+ BETA_BASE_URL = "https://graph.microsoft.com/beta".freeze
6
7
 
7
8
  include Endpoints::Me
8
9
  include Endpoints::Drive
@@ -34,8 +35,8 @@ module MicroslopOneDrive
34
35
 
35
36
  private
36
37
 
37
- def get(path:, query: {})
38
- url = "#{BASE_URL}/#{path}"
38
+ def get(path:, query: {}, base_url: BASE_URL)
39
+ url = "#{base_url}/#{path}"
39
40
  log_request("GET", url, query: query)
40
41
 
41
42
  response = HTTParty.get(url, headers: @headers, query: query)
@@ -44,8 +45,8 @@ module MicroslopOneDrive
44
45
  response
45
46
  end
46
47
 
47
- def post(path:, body:)
48
- url = "#{BASE_URL}/#{path}"
48
+ def post(path:, body:, base_url: BASE_URL)
49
+ url = "#{base_url}/#{path}"
49
50
  log_request("POST", url, body: body)
50
51
 
51
52
  response = HTTParty.post(url, headers: @headers, body: body)
@@ -54,8 +55,8 @@ module MicroslopOneDrive
54
55
  response
55
56
  end
56
57
 
57
- def delete(path:)
58
- url = "#{BASE_URL}/#{path}"
58
+ def delete(path:, base_url: BASE_URL)
59
+ url = "#{base_url}/#{path}"
59
60
  log_request("DELETE", url, body: nil)
60
61
 
61
62
  response = HTTParty.delete(url, headers: @headers)
@@ -2,6 +2,9 @@ module MicroslopOneDrive
2
2
  module Deserializers
3
3
  class GrantedToDeserializer
4
4
  def self.create_from_hash(granted_to_hash)
5
+ return nil if granted_to_hash.nil?
6
+ return nil if granted_to_hash.empty?
7
+
5
8
  granted_to_hash = Utils.deep_symbolize_keys(granted_to_hash)
6
9
 
7
10
  if granted_to_hash.key?(:siteUser)
@@ -47,7 +47,7 @@ module MicroslopOneDrive
47
47
  common_parameters = build_common_parameters(permission_hash)
48
48
 
49
49
  granted_to_hash_list = permission_hash.fetch(:grantedToIdentitiesV2, [])
50
- granted_to_list = granted_to_hash_list.map { GrantedToDeserializer.create_from_hash(it) }
50
+ granted_to_list = granted_to_hash_list.map { GrantedToDeserializer.create_from_hash(it) }.compact
51
51
 
52
52
  has_password = permission_hash.fetch(:hasPassword, false)
53
53
 
@@ -19,7 +19,11 @@ module MicroslopOneDrive
19
19
  def revoke_grants(item_id:, permission_id:, grantees:)
20
20
  url = "me/drive/items/#{item_id}/permissions/#{permission_id}/revokeGrants"
21
21
 
22
- response = post(path: url, body: {grantees: grantees}.to_json)
22
+ response = post(
23
+ path: url,
24
+ body: {grantees: grantees}.to_json,
25
+ base_url: MicroslopOneDrive::Client::BETA_BASE_URL
26
+ )
23
27
 
24
28
  return true if response.success?
25
29
 
@@ -1,3 +1,3 @@
1
1
  module MicroslopOneDrive
2
- VERSION = "5.1.0".freeze
2
+ VERSION = "5.1.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microslop_one_drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Marques