Class: EasyApiDoc::Action
- Inherits:
-
Object
- Object
- EasyApiDoc::Action
show all
- Includes:
- Configurable
- Defined in:
- app/models/easy_api_doc/action.rb
Instance Method Summary
collapse
#[], #[]=, #defaults, included, #inherited_overridable, #initialize, #load_children
Instance Method Details
#authentication ⇒ Object
50
51
52
|
# File 'app/models/easy_api_doc/action.rb', line 50
def authentication
@authentication ||= inherited_overridable('authentication', :from => ['resource', 'namespace', 'apiversion'])
end
|
45
46
47
48
|
# File 'app/models/easy_api_doc/action.rb', line 45
def formats
v = inherited_overridable('formats', :from => ['resource', 'namespace'])
v.split(/\,\s/) if v
end
|
#host ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'app/models/easy_api_doc/action.rb', line 36
def host
v = @parents['apiversion']
if v && v.attributes['defaults']
v.attributes['defaults']['domain']
else
nil
end
end
|
#options ⇒ Object
54
55
56
|
# File 'app/models/easy_api_doc/action.rb', line 54
def options
@attributes['options']
end
|
#parameters ⇒ Object
def run(params, method, format)
uri = URI(path + "." + format)
res = Net::HTTP.send(method.downcase, uri)
res
end
23
24
25
|
# File 'app/models/easy_api_doc/action.rb', line 23
def parameters
@parameters ||= load_children(EasyApiDoc::Parameter, 'parameters')
end
|
#path ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'app/models/easy_api_doc/action.rb', line 7
def path
uri = attributes['uri']
if host
"#{protocol}://#{host}#{uri}"
else
uri
end
end
|
#post_data ⇒ Object
27
28
29
|
# File 'app/models/easy_api_doc/action.rb', line 27
def post_data
attributes['post_data']
end
|
#protocol ⇒ Object
31
32
33
34
|
# File 'app/models/easy_api_doc/action.rb', line 31
def protocol
v = @parents['apiversion']
v.attributes['defaults']['protocol'] || 'http'
end
|