restful-sharepoint 0.1.4 → 0.1.5

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: 2ca679f36d66daff66ceeb2fd5729912c2456d3278ada4b48c3fe699156304c6
4
- data.tar.gz: 3e6b945bdc955541eeb15a99c573332b94008b898abd4bde1caaee34a672b3e5
3
+ metadata.gz: d457fe2a3101a2804ff42572417f3df0cb9aaa550566384ddeb2abc48e123de6
4
+ data.tar.gz: dab1ddd69bfeba89a82ec286fe75bc4f9f6c7f7b130a6af71f4cab664d07046b
5
5
  SHA512:
6
- metadata.gz: e497de459b6591614650fd1166a62db1563bd79cd5c733ab735b43e502955400f58c070bccf6aa6126bba82dcbd17b1ba89c4665dd9e3562e6060925718abb26
7
- data.tar.gz: a75b83c704266a223be6e820775cc0f6a39ea60d11c5942ab91d9f351ce83eafe733c8a58d6c4364837085fa78fe59ca9c0b415e7aa64c3c686c2e2ee12f52bd
6
+ metadata.gz: d4142d847ed5da39ffb538671b3ce23795a1679ff0f03e3e29958f73288f5a5bb427732005b92880641be7a3f28a9faa22731f02e074082b51407484f7a818c4
7
+ data.tar.gz: f5dbacb4e4d3a2cee8abf1a23d3bfa73343c2213ac4e0bf8894b7a0493e9fe0dba826b1310e3d76756f594489826bee58546df59ecd98b4890ecc17fa94868a8
@@ -2,16 +2,15 @@ module RestfulSharePoint
2
2
  class CommonBase
3
3
  # Converts the given enumerable tree to a collection or object.
4
4
  def objectify(tree)
5
- klass = nil
6
5
  if tree['results'] && !tree['results'].empty?
7
- if type = tree.dig('__metadata', 'type') || tree.dig('results', 0, '__metadata', 'type')
8
- pattern, klass = COLLECTION_MAP.find { |pattern,| pattern.match(type) }
9
- end
6
+ type = tree.dig('__metadata', 'type') || tree.dig('results', 0, '__metadata', 'type')
7
+ raise "Object type not specified" unless type
8
+ pattern, klass = COLLECTION_MAP.find { |pattern,| pattern.match(type) }
10
9
  klass ? RestfulSharePoint.const_get(klass).new(parent: self, collection: tree['results']) : tree['results']
11
10
  elsif tree['__metadata']
12
- if type = tree['__metadata']['type']
13
- pattern, klass = OBJECT_MAP.find { |pattern,| pattern.match(type) }
14
- end
11
+ type = tree['__metadata']['type']
12
+ raise "Collection type not specified" unless type
13
+ pattern, klass = OBJECT_MAP.find { |pattern,| pattern.match(type) }
15
14
  klass ? RestfulSharePoint.const_get(klass).new(parent: self, properties: tree) : tree
16
15
  end
17
16
  end
@@ -1,3 +1,3 @@
1
1
  module RestfulSharePoint
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful-sharepoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Wardrop