Class: PlatformLib::DataService
- Inherits:
-
Object
- Object
- PlatformLib::DataService
show all
- Defined in:
- lib/platform_lib/data_service.rb
Instance Method Summary
collapse
Constructor Details
#initialize(username, password) ⇒ DataService
8
9
10
11
12
13
14
|
# File 'lib/platform_lib/data_service.rb', line 8
def initialize(username, password)
@username = username
@password = password
@auth_token = nil
@services = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/platform_lib/data_service.rb', line 16
def method_missing(method_name, *args)
if method_name =~ /^(.*)_service$/
service_by_name($1)
else
super
end
end
|
Instance Method Details
#sign_out ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/platform_lib/data_service.rb', line 24
def sign_out
return if @auth_token.nil?
url = AUTH_URL_FORMAT.sub(/ACTION/, 'signOut')
url << "&_token=#{@auth_token}"
uri = URI.parse(url)
response = WebHelper::get(uri, :user => @username, :pass => @password)
@auth_token = nil
@services.clear
end
|