google_apps 0.4 → 0.4.1

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.
Files changed (2) hide show
  1. data/lib/google_apps/atom/group.rb +13 -1
  2. metadata +2 -2
@@ -1,6 +1,8 @@
1
1
  module GoogleApps
2
2
  module Atom
3
3
  class Group
4
+ #ATTRIBUTES = %w(id name description perms).map(&:to_sym)
5
+
4
6
  def initialize
5
7
  @document = Atom::XML::Document.new
6
8
  add_header
@@ -9,16 +11,26 @@ module GoogleApps
9
11
  # new_group populates the Group XML document with
10
12
  # the provided values. new_group accepts a hash
11
13
  # with the following keys: id, name, description
12
- # and perms.
14
+ # and perms. id and name are required for a call
15
+ # to new_group.
13
16
  #
14
17
  # new_group id: 'ID', name: 'Name', description: 'Group Description',
15
18
  # perms: 'emailPermissions'
16
19
  #
17
20
  # new_group returns @document.root
18
21
  def new_group(group_data)
22
+ [:id, :name].each { |attr| raise(ArgumentError, "Missing or Invalid Parameter(s)") unless group_data.key?(attr) }
19
23
  set_values group_data
20
24
  end
21
25
 
26
+
27
+ # set_values will add the specified group attributes
28
+ # to @document. set_values accepts a hash with any of
29
+ # the following keys: id:, name:, description:, perms:
30
+ #
31
+ # set_values id: 'blah', description: 'Unexciting and uninspired'
32
+ #
33
+ # set_values returns @document.root
22
34
  def set_values(group_values)
23
35
  group_values.keys.each do |key|
24
36
  prop = Atom::XML::Node.new('apps:property')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_apps
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-04 00:00:00.000000000 Z
12
+ date: 2012-06-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Library for interfacing with Google Apps' Domain and Application APIs
15
15
  email: