Class: LinodeAPI::Raw
Overview
Raw API object
Instance Attribute Summary collapse
-
#apikey ⇒ Object
readonly
Returns the value of attribute apikey.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Raw
constructor
A new instance of Raw.
- #respond_to?(method, include_private = false) ⇒ Boolean
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(params = {}) ⇒ Raw
14 15 16 17 18 19 |
# File 'lib/linodeapi/raw.rb', line 14 def initialize(params = {}) self.class.base_uri params.fetch(:endpoint, DEFAULT_ENDPOINT) @names = params.fetch(:names) { [] } @spec = params.fetch(:spec) { LinodeAPI.spec } @apikey = params.fetch(:apikey) { authenticate(params).first } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
40 41 42 43 44 45 46 |
# File 'lib/linodeapi/raw.rb', line 40 def method_missing(method, *args, &block) return super unless respond_to? method case @spec[:subs][method][:type] when :group then make_group method when :call then make_call method, *args end end |
Instance Attribute Details
#apikey ⇒ Object (readonly)
Returns the value of attribute apikey.
12 13 14 |
# File 'lib/linodeapi/raw.rb', line 12 def apikey @apikey end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
12 13 14 |
# File 'lib/linodeapi/raw.rb', line 12 def names @names end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
12 13 14 |
# File 'lib/linodeapi/raw.rb', line 12 def spec @spec end |
Instance Method Details
#respond_to?(method, include_private = false) ⇒ Boolean
21 22 23 |
# File 'lib/linodeapi/raw.rb', line 21 def respond_to?(method, include_private = false) super || @spec[:subs].include?(method) end |
#to_s ⇒ Object Also known as: inspect
25 26 27 |
# File 'lib/linodeapi/raw.rb', line 25 def to_s 'LinodeAPI::Raw object' end |