Class: Cyclid::Client::Tilapia
- Inherits:
-
Object
- Object
- Cyclid::Client::Tilapia
- Defined in:
- lib/cyclid/client.rb
Overview
Tilapia is the standard Cyclid Ruby client. It provides an inteligent programmable API on top of the standard Cyclid REST API, complete with automatic signing of HTTP requests and HTTP error handling.
The client provides interfaces for managing Users, Organizations, Stages & Jobs. Refer to the documentation for those modules for more information.
In case you’re wondering, this class required a name: it couldn’t be ‘Cyclid’ and it couldn’t be ‘Client’. Tilapia are a common type of Cichlid…
Instance Attribute Summary collapse
-
#config ⇒ Config
readonly
Client configuration object.
-
#logger ⇒ Logger
readonly
Client logger object.
Instance Method Summary collapse
-
#initialize(options) ⇒ Tilapia
constructor
A new instance of Tilapia.
Methods included from Health
Methods included from Auth
Methods included from Stage
#stage_create, #stage_get, #stage_list, #stage_modify
Methods included from Job
#job_get, #job_list, #job_log, #job_stats, #job_status, #job_submit
Methods included from Organization
#org_add, #org_config_get, #org_config_set, #org_delete, #org_get, #org_list, #org_modify, #org_user_get, #org_user_permissions
Methods included from User
#user_add, #user_delete, #user_get, #user_list, #user_modify
Constructor Details
#initialize(options) ⇒ Tilapia
Returns a new instance of Tilapia.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/cyclid/client.rb', line 56 def initialize() @config = Config.new() # Create a logger log_level = [:log_level] || Logger::FATAL @logger = Logger.new(STDERR) @logger.level = log_level # Select the API methods to use @api = case @config.auth when AuthMethods::AUTH_NONE Api::None.new(@config, @logger) when AuthMethods::AUTH_HMAC Api::Hmac.new(@config, @logger) when AuthMethods::AUTH_BASIC Api::Basic.new(@config, @logger) when AuthMethods::AUTH_TOKEN Api::Token.new(@config, @logger) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
rubocop:disable Style/MethodMissing
95 96 97 |
# File 'lib/cyclid/client.rb', line 95 def method_missing(method, *args, &block) # rubocop:disable Style/MethodMissing @api.send(method, *args, &block) end |
Instance Attribute Details
#config ⇒ Config (readonly)
Returns Client configuration object.
48 49 50 |
# File 'lib/cyclid/client.rb', line 48 def config @config end |
#logger ⇒ Logger (readonly)
Returns Client logger object.
48 49 50 |
# File 'lib/cyclid/client.rb', line 48 def logger @logger end |