Skip to content

Commit 9ea568f

Browse files
committed
[API] Generator: Use full name for http methods and Utils so XPack can find them
1 parent 44c2891 commit 9ea568f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

elasticsearch-api/utils/thor/generate_source.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,17 @@ def __endpoint_parts
121121
def __http_method
122122
case @endpoint_name
123123
when 'index'
124-
'_id ? HTTP_PUT : HTTP_POST'
124+
'_id ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST'
125125
when 'count'
126126
<<~SRC
127127
if arguments[:body]
128-
HTTP_POST
128+
Elasticsearch::API::HTTP_POST
129129
else
130-
HTTP_GET
130+
Elasticsearch::API::HTTP_GET
131131
end
132132
SRC
133133
else
134-
"HTTP_#{@spec['url']['paths'].map { |a| a['methods'] }.flatten.first}"
134+
"Elasticsearch::API::HTTP_#{@spec['url']['paths'].map { |a| a['methods'] }.flatten.first}"
135135
end
136136
end
137137

@@ -161,7 +161,7 @@ def __http_path
161161

162162
def __parse_path(path)
163163
path.gsub(/^\//, '')
164-
.gsub('{', '#{Utils.__listify(_')
164+
.gsub('{', '#{Elasticsearch::API::Utils.__listify(_')
165165
.gsub('}', ')}')
166166
end
167167

elasticsearch-api/utils/thor/templates/_method_setup.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<%- end -%>
2626
<%= ' '*(@namespace_depth+4) %>path = <%= @http_path %>
2727
<%- unless @params.empty? -%>
28-
<%= ' '*(@namespace_depth+4) %>params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
28+
<%= ' '*(@namespace_depth+4) %>params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
2929
<%- else -%>
3030
<%= ' '*(@namespace_depth+4) %>params = {}
3131
<%- end -%>

elasticsearch-api/utils/thor/templates/_perform_request.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ when 'mtermvectors'
1919
<%= ping_perform_request %>
2020
<%- else -%>
2121
<%- if needs_ignore_404?(@endpoint_name) %>
22-
Utils.__rescue_from_not_found do
22+
Elasticsearch::API::Utils.__rescue_from_not_found do
2323
perform_request(method, path, params, body).status == 200 ? true : false
2424
end
2525
<%- elsif needs_complex_ignore_404?(@endpoint_name) -%>
2626
if Array(arguments[:ignore]).include?(404)
27-
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
27+
Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
2828
else
2929
perform_request(method, path, params, body).body
3030
end

0 commit comments

Comments
 (0)