Class: NamecheapApi::Client
- Inherits:
-
Object
- Object
- NamecheapApi::Client
- Defined in:
- lib/namecheap_api/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #call(command, parameters = {}) ⇒ Object
- #endpoint ⇒ Object
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/namecheap_api/client.rb', line 10 def initialize(config) @config = config @sandbox = config[:sandbox] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/namecheap_api/client.rb', line 8 def config @config end |
Instance Method Details
#call(command, parameters = {}) ⇒ Object
15 16 17 |
# File 'lib/namecheap_api/client.rb', line 15 def call(command, parameters = {}) Response.new(new_request(command, parameters).call.body) end |
#endpoint ⇒ Object
19 20 21 |
# File 'lib/namecheap_api/client.rb', line 19 def endpoint @sandbox ? ENDPOINTS[:sandbox] : ENDPOINTS[:production] end |