Class: GoogleAppsOauth2::Transport

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/google_apps_oauth2/transport.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, &block) ⇒ Transport

Returns a new instance of Transport.



14
15
16
17
18
19
20
21
22
23
# File 'lib/google_apps_oauth2/transport.rb', line 14

def initialize(options, &block)
  @domain = options[:domain]
  @token = options[:token]
  @client_id = options[:client_id]
  @client_secret = options[:client_secret]
  @refresh_token = options[:refresh_token]
  @token_changed_block = block

  @user_path= "/#{@domain}/user/2.0"
end

Instance Method Details

#get_users(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/google_apps_oauth2/transport.rb', line 25

def get_users(options = {})
  headers = {'content-type' => 'application/atom+xml', 'Authorization' => "OAuth #{token}"}

  url = user_path + "?startUsername=#{options[:start]}"
  response = self.class.get(url, headers: headers)
  response = check_for_refresh(response)

  response
end