Class: GoogleAppsApi::BaseApi
- Inherits:
-
Object
- Object
- GoogleAppsApi::BaseApi
- Defined in:
- lib/google_apps_api/base_api.rb
Direct Known Subclasses
Calendar::Api, CalendarResources::Api, Contacts::Api, Provisioning::Api, UserProfiles::Api
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
Instance Method Summary collapse
- #entity(*args) ⇒ Object
-
#initialize(api_name, *args) ⇒ BaseApi
constructor
A new instance of BaseApi.
Constructor Details
#initialize(api_name, *args) ⇒ BaseApi
Returns a new instance of BaseApi.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/google_apps_api/base_api.rb', line 6 def initialize(api_name, *args) api_config = GoogleAppsApi.config[api_name] || {} = args..merge!(api_config) raise("Must supply admin_user") unless [:admin_user] raise("Must supply admin_password") unless [:admin_password] @domain = [:domain] || raise("Must supply domain") @actions_hash = [:action_hash] || raise("Must supply action hash") @actions_subs = [:action_subs] || raise("Must supply action subs") @actions_hash[:next] = [:get, ''] @actions_subs[:domain] = @domain @token = login([:admin_user], @domain, [:admin_password], [:service]) @headers = {'Content-Type'=>'application/atom+xml', 'Authorization'=> 'GoogleLogin auth='+@token}.merge([:headers] || {}) end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
3 4 5 |
# File 'lib/google_apps_api/base_api.rb', line 3 def domain @domain end |
Instance Method Details
#entity(*args) ⇒ Object
23 24 25 |
# File 'lib/google_apps_api/base_api.rb', line 23 def entity(*args) entity.merge(:domain => @domain) end |