Class: MoxiworksPlatform::Credentials
- Inherits:
-
Object
- Object
- MoxiworksPlatform::Credentials
- Defined in:
- lib/moxiworks_platform/credentials.rb
Overview
Moxi Works Platform Credentials
A Singleton class used for authorization on the Moxi Works Platform
Class Attribute Summary collapse
-
.instance ⇒ Object
Singleton instance of MoxiworksPlatform::Credentials.
-
.platform_identifier ⇒ String
The Moxi Works Platform Identifier associated with the MoxiworksPlatform::Credentials instance.
-
.platform_secret ⇒ String
The Moxi Works Platform Secret associated with the MoxiworksPlatform::Credentials instance.
Class Method Summary collapse
- .new(*args, &block) ⇒ MoxiWorksPlatform::Credentials
-
.set? ⇒ Boolean
whether the required values for authorization have been set in the Singleton instance of MoxiworksPlatform::Credentials.
Instance Method Summary collapse
-
#initialize(platform_identifier, platform_secret) ⇒ Credentials
constructor
A new instance of Credentials.
-
#inspect ⇒ Object
private
Removing the secret access key from the default inspect string.
-
#platform_identifier ⇒ String
The Moxi Works Platform Identifier associated with the MoxiworksPlatform::Credentials instance.
-
#platform_secret ⇒ String
The Moxi Works Platform Secret associated with the MoxiworksPlatform::Credentials instance.
-
#set? ⇒ Boolean
whether the required values for authorization have been set in the Singleton instance of MoxiworksPlatform::Credentials.
Constructor Details
#initialize(platform_identifier, platform_secret) ⇒ Credentials
Returns a new instance of Credentials.
69 70 71 72 73 74 |
# File 'lib/moxiworks_platform/credentials.rb', line 69 def initialize(platform_identifier, platform_secret) return if MoxiworksPlatform::Credentials.instance MoxiworksPlatform::Credentials.platform_identifier = platform_identifier MoxiworksPlatform::Credentials.platform_secret = platform_secret MoxiworksPlatform::Credentials.instance = self end |
Class Attribute Details
.instance ⇒ Object
Singleton instance of MoxiworksPlatform::Credentials
14 15 16 |
# File 'lib/moxiworks_platform/credentials.rb', line 14 def instance @instance end |
.platform_identifier ⇒ String
The Moxi Works Platform Identifier associated with the MoxiworksPlatform::Credentials instance
This should be set when MoxiworksPlafform::Credentials is instantiated
23 24 25 |
# File 'lib/moxiworks_platform/credentials.rb', line 23 def platform_identifier @platform_identifier end |
.platform_secret ⇒ String
The Moxi Works Platform Secret associated with the MoxiworksPlatform::Credentials instance
This should be set when MoxiworksPlafform::Credentials is instantiated
32 33 34 |
# File 'lib/moxiworks_platform/credentials.rb', line 32 def platform_secret @platform_secret end |
Class Method Details
.new(*args, &block) ⇒ MoxiWorksPlatform::Credentials
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/moxiworks_platform/credentials.rb', line 45 def self.new(*args, &block) pid = args[0] ps = args[1] return MoxiworksPlatform::Credentials.instance if MoxiworksPlatform::Credentials.instance and (pid == MoxiworksPlatform::Credentials.platform_identifier and ps == MoxiworksPlatform::Credentials.platform_secret) super(*args, &block) end |
.set? ⇒ Boolean
whether the required values for authorization have been set in the Singleton instance of MoxiworksPlatform::Credentials
59 60 61 62 63 64 |
# File 'lib/moxiworks_platform/credentials.rb', line 59 def self.set? not ((platform_identifier.nil? or platform_identifier.empty?) or (platform_secret.nil? or platform_secret.empty?)) end |
Instance Method Details
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Removing the secret access key from the default inspect string.
103 104 105 |
# File 'lib/moxiworks_platform/credentials.rb', line 103 def inspect "#<#{self.class.name} platform_identifier=#{platform_identifier.inspect}>" end |
#platform_identifier ⇒ String
The Moxi Works Platform Identifier associated with the MoxiworksPlatform::Credentials instance
This should be set when MoxiworksPlafform::Credentials is instantiated
81 82 83 |
# File 'lib/moxiworks_platform/credentials.rb', line 81 def platform_identifier MoxiworksPlatform::Credentials.platform_identifier end |
#platform_secret ⇒ String
The Moxi Works Platform Secret associated with the MoxiworksPlatform::Credentials instance
This should be set when MoxiworksPlafform::Credentials is instantiated
90 91 92 |
# File 'lib/moxiworks_platform/credentials.rb', line 90 def platform_secret MoxiworksPlatform::Credentials.platform_secret end |
#set? ⇒ Boolean
whether the required values for authorization have been set in the Singleton instance of MoxiworksPlatform::Credentials
97 98 99 |
# File 'lib/moxiworks_platform/credentials.rb', line 97 def set? MoxiworksPlatform::Credentials.set? end |