Class: Testcloud::Devices::Client
- Inherits:
-
Object
- Object
- Testcloud::Devices::Client
- Includes:
- HTTParty, Resources
- Defined in:
- lib/testcloud/devices/client.rb
Class Attribute Summary collapse
-
.config ⇒ Object
readonly
Returns the value of attribute config.
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#category ⇒ Object
Returns the value of attribute category.
-
#raw_response ⇒ Object
Returns the value of attribute raw_response.
-
#response ⇒ Object
Returns the value of attribute response.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #errors? ⇒ Boolean
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
24 25 26 27 28 29 |
# File 'lib/testcloud/devices/client.rb', line 24 def initialize( = {}) @type, @category = [:type], [:category] self.class.debug_output if [:debug] self.class.base_uri([:url] || config.url || Testcloud::Devices::Config::DEFAULT_URL) config.api_token = [:api_token] if [:api_token] end |
Class Attribute Details
.config ⇒ Object (readonly)
Returns the value of attribute config.
17 18 19 |
# File 'lib/testcloud/devices/client.rb', line 17 def config @config end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
9 10 11 |
# File 'lib/testcloud/devices/client.rb', line 9 def api_token @api_token end |
#category ⇒ Object
Returns the value of attribute category.
9 10 11 |
# File 'lib/testcloud/devices/client.rb', line 9 def category @category end |
#raw_response ⇒ Object
Returns the value of attribute raw_response.
9 10 11 |
# File 'lib/testcloud/devices/client.rb', line 9 def raw_response @raw_response end |
#response ⇒ Object
Returns the value of attribute response.
9 10 11 |
# File 'lib/testcloud/devices/client.rb', line 9 def response @response end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/testcloud/devices/client.rb', line 9 def type @type end |
Class Method Details
.setup {|@config| ... } ⇒ Object
18 19 20 21 |
# File 'lib/testcloud/devices/client.rb', line 18 def setup(&block) @config = Testcloud::Devices::Config.new yield(@config) end |
Instance Method Details
#errors? ⇒ Boolean
31 32 33 34 35 |
# File 'lib/testcloud/devices/client.rb', line 31 def errors? return true if raw_response.code >= 300 return true if response.has_key?(:errors) false end |