Class: LinodeAPI::Raw
- Inherits:
-
Object
show all
- Extended by:
- Helpers
- Includes:
- HTTParty
- Defined in:
- lib/linodeapi/raw.rb
Overview
Instance Method Summary
collapse
Methods included from Helpers
clean, create_http_error, error_check, parse, validate
Constructor Details
#initialize(params = {}) ⇒ Raw
Returns a new instance of Raw.
13
14
15
16
17
18
19
|
# File 'lib/linodeapi/raw.rb', line 13
def initialize(params = {})
@options = params
@options[:endpoint] ||= DEFAULT_ENDPOINT
@options[:names] ||= []
@options[:spec] ||= LinodeAPI.spec
@options[:apikey] ||= authenticate(params)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/linodeapi/raw.rb', line 56
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 Method Details
#apikey ⇒ Object
38
39
40
|
# File 'lib/linodeapi/raw.rb', line 38
def apikey
@apikey ||= @options[:apikey]
end
|
#endpoint ⇒ Object
42
43
44
|
# File 'lib/linodeapi/raw.rb', line 42
def endpoint
@endpoint ||= @options[:endpoint]
end
|
#names ⇒ Object
30
31
32
|
# File 'lib/linodeapi/raw.rb', line 30
def names
@names ||= @options[:names]
end
|
#respond_to_missing?(method, include_private = false) ⇒ Boolean
21
22
23
|
# File 'lib/linodeapi/raw.rb', line 21
def respond_to_missing?(method, include_private = false)
spec[:subs].include?(method) || super
end
|
#spec ⇒ Object
34
35
36
|
# File 'lib/linodeapi/raw.rb', line 34
def spec
@spec ||= @options[:spec]
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
|