gaah 0.1.4.1 → 0.1.5

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDA5OTBlMGJhMTU3MjFiOTk5Y2IzMjQ2MjY1NDhiMzhmMDUyODAwMA==
4
+ YTBkODhhM2NlNjc3ZTFjMDA2OWMwMmY3NTU2Y2I4NjVhNTZkMzQ2MA==
5
5
  data.tar.gz: !binary |-
6
- ZGUyZDEyMjVjYjhmYjczZjNiYzQ2M2I3NTllNGY0Y2Q1ODM5ODAzYw==
6
+ MjhiNTE1NzZjNjlmZTBkNjNmZGFkOWViMDU2ODI5YTdlNjRmNjFlZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTM0ZGVlNmUzNzJiZjk2YWNlZmIwZjJmZGI2YWI3MzI1Y2UwNDViMTU3MjIz
10
- N2JmMDU1ZDIzNjVhNTA2NWE0ZGFkZmRhZTM5YTg1MmM3OWU0M2I5M2IzZGRm
11
- NTJjYWU2OGZjNjRmZDdkZGY1NjhlN2IxZDhjM2IyODllOWZjMTI=
9
+ YzA0YjBjY2EyMzE4NTI5M2VmY2VmOGFmMzUxYjJjY2E2OGRlYjU2NzhmMzIw
10
+ YzUzMzdkYTJhYTgyNjMxNzQ2NWQxZmQzZDgxZjkxOTI3NGIzYzhmN2IzZDA1
11
+ MTlhNjhiNGEyMzhlYWQxODFmNjc1YTlmMTEzYzY5ZTBjY2Q3ZmU=
12
12
  data.tar.gz: !binary |-
13
- YWNiMDQ3ZDlkZTM3YzRiZjVhYmE4OTMwODFiOWNkNTgzNDk1NzdlMDgxMGJh
14
- NTBhMTE5ZTMzMGFmOWEyZjYwZDZiYTc2MGE5OWRmNjk3NTg4YmE2Yjc2ODY3
15
- M2QyYzcxZmNiYTRkNWFmM2QxYjkxM2QzYzc2NDUxYWU1MGU3YmQ=
13
+ YzRkMTg2MTRkYzVkMzMwNWFlNDNhMjFkMzc3YzgwYTJkYzljNTcyM2RjM2Y5
14
+ MWRkNWZjZjBmZTVlZDlmYjZlNzhmMWJhOGRjZmUxOWU4YjU0OWVkODA5NjMz
15
+ NWNjZDhiMTQzODM0ZDU5ZDdlNzI5M2U0ZDllZDA4ZTc2Mjg2MmE=
data/README.md CHANGED
@@ -46,6 +46,6 @@ Warning: Google documentation links sometimes move without good redirection.
46
46
  * [Google Apps Provisioning API v2](https://developers.google.com/google-apps/provisioning/)
47
47
 
48
48
  ### Todo
49
- * Look into data api v3 when Provisioning API is updated
49
+ * Provisioning API is deprecated, use Directory API
50
50
  * Possibly integrate [Google Apps Calendar Resource API](https://developers.google.com/google-apps/calendar-resource/)
51
51
  * Error handling
@@ -5,10 +5,24 @@ module Gaah
5
5
  class Api
6
6
  class << self
7
7
  def users
8
- url = "https://apps-apis.google.com/a/feeds/#{Gaah.domain}/user/2.0"
9
- xml = ApiClient.instance.get(url)
10
- users = Nokogiri::XML(xml)/:entry
11
- User.batch_create(users)
8
+ fetch_users("https://apps-apis.google.com/a/feeds/#{Gaah.domain}/user/2.0")
9
+ end
10
+
11
+ private
12
+
13
+ def fetch_users(url)
14
+ xml = ApiClient.instance.get(url)
15
+ parsed = Nokogiri::XML(xml)
16
+
17
+ current_users = User.batch_create(parsed/:entry)
18
+ next_link = (parsed/'link[rel=next]').first
19
+
20
+ if next_link.nil?
21
+ current_users
22
+ else
23
+ url = next_link.attr('href')
24
+ current_users + fetch_users(url)
25
+ end
12
26
  end
13
27
  end
14
28
  end
@@ -1,3 +1,3 @@
1
1
  module Gaah
2
- VERSION = "0.1.4.1"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hwan-Joon Choi