Class: Imperium::Client
- Inherits:
-
Object
- Object
- Imperium::Client
- Defined in:
- lib/imperium/client.rb
Constant Summary collapse
- UNIVERSAL_API_OPTIONS =
Options that are allowed for all API endpoints
%i{dc}.freeze
Class Attribute Summary collapse
-
.path_prefix ⇒ Object
Returns the value of attribute path_prefix.
-
.subclasses ⇒ Object
readonly
Returns the value of attribute subclasses.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
- .default_client ⇒ Object
- .inherited(subclass) ⇒ Object
- .reset_default_client ⇒ Object
- .reset_default_clients ⇒ Object
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #path_prefix ⇒ Object
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
33 34 35 36 |
# File 'lib/imperium/client.rb', line 33 def initialize(config) @config = config @http_client = Imperium::HTTPClient.new(config) end |
Class Attribute Details
.path_prefix ⇒ Object
Returns the value of attribute path_prefix.
11 12 13 |
# File 'lib/imperium/client.rb', line 11 def path_prefix @path_prefix end |
.subclasses ⇒ Object (readonly)
Returns the value of attribute subclasses.
10 11 12 |
# File 'lib/imperium/client.rb', line 10 def subclasses @subclasses end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
31 32 33 |
# File 'lib/imperium/client.rb', line 31 def config @config end |
Class Method Details
.default_client ⇒ Object
13 14 15 |
# File 'lib/imperium/client.rb', line 13 def default_client @default_client ||= new(Imperium.configuration) end |
.inherited(subclass) ⇒ Object
23 24 25 |
# File 'lib/imperium/client.rb', line 23 def self.inherited(subclass) @subclasses << subclass end |
.reset_default_client ⇒ Object
17 18 19 |
# File 'lib/imperium/client.rb', line 17 def reset_default_client @default_client = nil end |
.reset_default_clients ⇒ Object
27 28 29 |
# File 'lib/imperium/client.rb', line 27 def self.reset_default_clients @subclasses.each(&:reset_default_client) end |
Instance Method Details
#path_prefix ⇒ Object
38 39 40 |
# File 'lib/imperium/client.rb', line 38 def path_prefix self.class.path_prefix end |