Class: GoogleAppsApi::BaseApi

Inherits:
Object
  • Object
show all
Defined in:
lib/google_apps_api/base_api.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (BaseApi) initialize(api_name, *args)

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] || {}
  options = args.extract_options!.merge!(api_config)
  raise("Must supply admin_user") unless options[:admin_user] 
  raise("Must supply admin_password") unless options[:admin_password]
  @domain = options[:domain] || raise("Must supply domain") 
  @actions_hash = options[:action_hash] || raise("Must supply action hash")
  @actions_subs = options[:action_subs] || raise("Must supply action subs")
  @actions_hash[:next] = [:get, '']
  @actions_subs[:domain] = @domain

  @token = (options[:admin_user], @domain, options[:admin_password], options[:service])
  @headers = {'Content-Type'=>'application/atom+xml', 'Authorization'=> 'GoogleLogin auth='+@token}.merge(options[:headers] || {})

end

Instance Attribute Details

- (Object) domain (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

- (Object) entity(*args)



23
24
25
# File 'lib/google_apps_api/base_api.rb', line 23

def entity(*args)
  entity.merge(:domain => @domain)
end