Class: HaveAPI::GoClient::InputOutput
- Inherits:
-
Object
- Object
- HaveAPI::GoClient::InputOutput
show all
- Includes:
- Utils
- Defined in:
- lib/haveapi/go_client/input_output.rb
Constant Summary
Constants included
from Utils
Utils::GO_KEYWORDS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Utils
#camelize, #go_comment_text, #go_json_tag, #go_module_path, #go_package_name, #go_query_key, #go_string_literal, #safe_file_component
Constructor Details
#initialize(action, role, direction, desc, prefix: nil) ⇒ InputOutput
Returns a new instance of InputOutput.
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/haveapi/go_client/input_output.rb', line 31
def initialize(action, role, direction, desc, prefix: nil)
@action = action
@role = role
@direction = direction
@layout = desc[:layout]
@namespace = desc[:namespace]
@parameters = desc[:parameters].map do |k, v|
Parameter.new(role, direction, self, k.to_s, v)
end.compact.sort!
@go_type = action.go_type + (prefix || '') + direction.to_s.capitalize
@go_namespace = camelize(desc[:namespace])
end
|
Instance Attribute Details
8
9
10
|
# File 'lib/haveapi/go_client/input_output.rb', line 8
def action
@action
end
|
#direction ⇒ Symbol
14
15
16
|
# File 'lib/haveapi/go_client/input_output.rb', line 14
def direction
@direction
end
|
#go_namespace ⇒ String
29
30
31
|
# File 'lib/haveapi/go_client/input_output.rb', line 29
def go_namespace
@go_namespace
end
|
#go_type ⇒ String
26
27
28
|
# File 'lib/haveapi/go_client/input_output.rb', line 26
def go_type
@go_type
end
|
#layout ⇒ String
17
18
19
|
# File 'lib/haveapi/go_client/input_output.rb', line 17
def layout
@layout
end
|
#namespace ⇒ String
20
21
22
|
# File 'lib/haveapi/go_client/input_output.rb', line 20
def namespace
@namespace
end
|
#parameters ⇒ Array<Parameter>
23
24
25
|
# File 'lib/haveapi/go_client/input_output.rb', line 23
def parameters
@parameters
end
|
#role ⇒ Symbol
11
12
13
|
# File 'lib/haveapi/go_client/input_output.rb', line 11
def role
@role
end
|
Instance Method Details
#resolve_associations ⇒ Object
44
45
46
|
# File 'lib/haveapi/go_client/input_output.rb', line 44
def resolve_associations
parameters.each(&:resolve)
end
|