Class: PlatformLib::BusinessService
- Inherits:
-
Object
- Object
- PlatformLib::BusinessService
- Defined in:
- lib/platform_lib/business_service.rb
Instance Method Summary collapse
-
#initialize(username, password) ⇒ BusinessService
constructor
A new instance of BusinessService.
- #method_missing(method_name, *args) ⇒ Object
- #sign_out ⇒ Object
Constructor Details
#initialize(username, password) ⇒ BusinessService
Returns a new instance of BusinessService.
8 9 10 11 12 13 14 |
# File 'lib/platform_lib/business_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/business_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/business_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 |