Class: Gapic::Presenters::ServiceRestPresenter

Inherits:
Object
  • Object
show all
Includes:
Helpers::FilepathHelper, Helpers::NamespaceHelper
Defined in:
lib/gapic/presenters/service_rest_presenter.rb

Overview

A presenter for proto service (REST submethods)

Instance Method Summary collapse

Methods included from Helpers::NamespaceHelper

#ensure_absolute_namespace, #fix_namespace, #ruby_namespace, #ruby_namespace_for_address

Methods included from Helpers::FilepathHelper

#fix_file_path, #ruby_file_path, #ruby_file_path_for_namespace

Constructor Details

#initialize(main_service, api) ⇒ ServiceRestPresenter

Returns a new instance of ServiceRestPresenter.

Parameters:



34
35
36
37
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 34

def initialize main_service, api
  @main_service = main_service
  @api = api
end

Instance Method Details

#client_file_pathString

Returns:

  • (String)


127
128
129
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 127

def client_file_path
  "#{client_require}.rb"
end

#client_nameString

Returns:

  • (String)


106
107
108
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 106

def client_name
  main_service.client_name
end

#client_name_fullString

Returns:

  • (String)


113
114
115
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 113

def client_name_full
  fix_namespace api, "#{service_name_full}::#{client_name}"
end

#client_requireString

Returns:

  • (String)


120
121
122
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 120

def client_require
  ruby_file_path api, client_name_full
end

#configure_client_callString

Returns:

  • (String)


169
170
171
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 169

def configure_client_call
  "#{client_name_full}.configure"
end

#create_client_callString

Returns:

  • (String)


134
135
136
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 134

def create_client_call
  "#{client_name_full}.new"
end

#credentials_class_xrefString

Returns:

  • (String)


162
163
164
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 162

def credentials_class_xref
  main_service.credentials_class_xref
end

#methodsEnumerable<Gapic::Presenters::MethodPresenter>

Returns:



234
235
236
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 234

def methods
  main_service.methods
end

#nameString

Ruby name of this service

Returns:

  • (String)


44
45
46
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 44

def name
  main_service.name
end

#nonstandard_lro_file_nameString

File name of the nonstandard LRO module

Returns:

  • (String)


205
206
207
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 205

def nonstandard_lro_file_name
  nonstandard_lro_file_path.split("/").last
end

#nonstandard_lro_file_pathString

Full file path to the nonstandard LRO module

Returns:

  • (String)


196
197
198
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 196

def nonstandard_lro_file_path
  "#{nonstandard_lro_require}.rb"
end

#nonstandard_lro_nameString

Name of the nonstandard LRO module

Returns:

  • (String)


178
179
180
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 178

def nonstandard_lro_name
  "NonstandardLro"
end

#nonstandard_lro_name_fullString

Full name of the nonstandard LRO module

Returns:

  • (String)


187
188
189
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 187

def nonstandard_lro_name_full
  fix_namespace @api, "#{service_name_full}::#{nonstandard_lro_name}"
end

#nonstandard_lro_requireString

The require string for the nonstandard LRO module

Returns:

  • (String)


214
215
216
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 214

def nonstandard_lro_require
  ruby_file_path @api, "#{service_name_full}::#{nonstandard_lro_name}"
end

#quick_start_methodGapic::Presenters::MethodRestPresenter?

The method to use for quick start samples. Normally this is simply the first non-client-streaming method defined, but it can be overridden via a gem config.

Returns:



227
228
229
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 227

def quick_start_method
  main_service.quick_start_method&.rest
end

#service_directory_nameString

Folder name for this service

Returns:

  • (String)


71
72
73
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 71

def service_directory_name
  service_require.split("/")[-2]
end

#service_name_fullString

Full Ruby name of this service

Returns:

  • (String)


53
54
55
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 53

def service_name_full
  fix_namespace api, "#{main_service.service_name_full}::Rest"
end

#service_requireString

Require path for this service

Returns:

  • (String)


62
63
64
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 62

def service_require
  ruby_file_path @api, service_name_full
end

#service_rest_file_pathString

Returns:

  • (String)


148
149
150
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 148

def service_rest_file_path
  "#{service_rest_require}.rb"
end

#service_rest_requireString

Returns:

  • (String)


141
142
143
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 141

def service_rest_require
  ruby_file_path api, service_name_full
end

#service_stub_file_pathString

Returns:

  • (String)


99
100
101
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 99

def service_stub_file_path
  "#{service_stub_require}.rb"
end

#service_stub_nameString

Returns:

  • (String)


78
79
80
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 78

def service_stub_name
  "ServiceStub"
end

#service_stub_name_fullString

Returns:

  • (String)


85
86
87
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 85

def service_stub_name_full
  fix_namespace api, "#{service_name_full}::#{service_stub_name}"
end

#service_stub_requireString

Returns:

  • (String)


92
93
94
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 92

def service_stub_require
  ruby_file_path api, service_stub_name_full
end

#test_client_file_pathString

Returns:

  • (String)


155
156
157
# File 'lib/gapic/presenters/service_rest_presenter.rb', line 155

def test_client_file_path
  main_service.service_file_path.sub ".rb", "_test.rb"
end