Class: Zernio::GMBVerificationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/gmb_verifications_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ GMBVerificationsApi

Returns a new instance of GMBVerificationsApi.



19
20
21
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#complete_google_business_verification(account_id, verification_id, complete_google_business_verification_request, opts = {}) ⇒ StartGoogleBusinessVerification200Response

Complete a verification Completes a PENDING verification by submitting the PIN/code Google sent the business (postcard code, SMS PIN, etc.). On success the verification moves to COMPLETED.

Parameters:

  • account_id (String)

    The Zernio account ID (from /v1/accounts)

  • verification_id (String)

    The last segment of a verification `name` from GET /gmb-verifications.

  • complete_google_business_verification_request (CompleteGoogleBusinessVerificationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    Override which location to target. If omitted, uses the account's selected location.

Returns:



30
31
32
33
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 30

def complete_google_business_verification(, verification_id, complete_google_business_verification_request, opts = {})
  data, _status_code, _headers = complete_google_business_verification_with_http_info(, verification_id, complete_google_business_verification_request, opts)
  data
end

#complete_google_business_verification_with_http_info(account_id, verification_id, complete_google_business_verification_request, opts = {}) ⇒ Array<(StartGoogleBusinessVerification200Response, Integer, Hash)>

Complete a verification Completes a PENDING verification by submitting the PIN/code Google sent the business (postcard code, SMS PIN, etc.). On success the verification moves to COMPLETED.

Parameters:

  • account_id (String)

    The Zernio account ID (from /v1/accounts)

  • verification_id (String)

    The last segment of a verification `name` from GET /gmb-verifications.

  • complete_google_business_verification_request (CompleteGoogleBusinessVerificationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    Override which location to target. If omitted, uses the account's selected location.

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 43

def complete_google_business_verification_with_http_info(, verification_id, complete_google_business_verification_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBVerificationsApi.complete_google_business_verification ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling GMBVerificationsApi.complete_google_business_verification"
  end
  # verify the required parameter 'verification_id' is set
  if @api_client.config.client_side_validation && verification_id.nil?
    fail ArgumentError, "Missing the required parameter 'verification_id' when calling GMBVerificationsApi.complete_google_business_verification"
  end
  # verify the required parameter 'complete_google_business_verification_request' is set
  if @api_client.config.client_side_validation && complete_google_business_verification_request.nil?
    fail ArgumentError, "Missing the required parameter 'complete_google_business_verification_request' when calling GMBVerificationsApi.complete_google_business_verification"
  end
  if @api_client.config.client_side_validation && !opts[:'location_id'].nil? && opts[:'location_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"location_id"]" when calling GMBVerificationsApi.complete_google_business_verification, the character length must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/gmb-verifications/{verificationId}/complete'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'verificationId' + '}', CGI.escape(verification_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'locationId'] = opts[:'location_id'] if !opts[:'location_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(complete_google_business_verification_request)

  # return_type
  return_type = opts[:debug_return_type] || 'StartGoogleBusinessVerification200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"GMBVerificationsApi.complete_google_business_verification",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GMBVerificationsApi#complete_google_business_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#fetch_google_business_verification_options(account_id, fetch_google_business_verification_options_request, opts = {}) ⇒ FetchGoogleBusinessVerificationOptions200Response

Fetch verification options Reports the verification methods Google currently offers for the location. Non-mutating (nothing is sent to the business). languageCode is required; service-area ("CUSTOMER_LOCATION_ONLY") businesses also require context.address, otherwise Google returns 400.

Parameters:

Options Hash (opts):

  • :location_id (String)

    Override which location to query. If omitted, uses the account's selected location.

Returns:



116
117
118
119
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 116

def fetch_google_business_verification_options(, fetch_google_business_verification_options_request, opts = {})
  data, _status_code, _headers = fetch_google_business_verification_options_with_http_info(, fetch_google_business_verification_options_request, opts)
  data
end

#fetch_google_business_verification_options_with_http_info(account_id, fetch_google_business_verification_options_request, opts = {}) ⇒ Array<(FetchGoogleBusinessVerificationOptions200Response, Integer, Hash)>

Fetch verification options Reports the verification methods Google currently offers for the location. Non-mutating (nothing is sent to the business). `languageCode` is required; service-area (&quot;CUSTOMER_LOCATION_ONLY&quot;) businesses also require `context.address`, otherwise Google returns 400.

Parameters:

Options Hash (opts):

  • :location_id (String)

    Override which location to query. If omitted, uses the account's selected location.

Returns:



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 128

def fetch_google_business_verification_options_with_http_info(, fetch_google_business_verification_options_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBVerificationsApi.fetch_google_business_verification_options ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling GMBVerificationsApi.fetch_google_business_verification_options"
  end
  # verify the required parameter 'fetch_google_business_verification_options_request' is set
  if @api_client.config.client_side_validation && fetch_google_business_verification_options_request.nil?
    fail ArgumentError, "Missing the required parameter 'fetch_google_business_verification_options_request' when calling GMBVerificationsApi.fetch_google_business_verification_options"
  end
  if @api_client.config.client_side_validation && !opts[:'location_id'].nil? && opts[:'location_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"location_id"]" when calling GMBVerificationsApi.fetch_google_business_verification_options, the character length must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/gmb-verifications/options'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'locationId'] = opts[:'location_id'] if !opts[:'location_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(fetch_google_business_verification_options_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FetchGoogleBusinessVerificationOptions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"GMBVerificationsApi.fetch_google_business_verification_options",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GMBVerificationsApi#fetch_google_business_verification_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_google_business_verifications(account_id, opts = {}) ⇒ GetGoogleBusinessVerifications200Response

Get verification state Returns the location's Voice of Merchant state plus its verification history. voiceOfMerchantState.hasVoiceOfMerchant tells you whether the listing is verified and published; when it is false, verify reports whether a verification is already pending. Each entry in verifications has a state of PENDING, COMPLETED, or FAILED.

Parameters:

  • account_id (String)

    The Zernio account ID (from /v1/accounts)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    Override which location to query. If omitted, uses the account's selected location. Use GET /gmb-locations to list valid IDs.

Returns:



196
197
198
199
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 196

def get_google_business_verifications(, opts = {})
  data, _status_code, _headers = get_google_business_verifications_with_http_info(, opts)
  data
end

#get_google_business_verifications_with_http_info(account_id, opts = {}) ⇒ Array<(GetGoogleBusinessVerifications200Response, Integer, Hash)>

Get verification state Returns the location's Voice of Merchant state plus its verification history. `voiceOfMerchantState.hasVoiceOfMerchant` tells you whether the listing is verified and published; when it is false, `verify` reports whether a verification is already pending. Each entry in `verifications` has a `state` of PENDING, COMPLETED, or FAILED.

Parameters:

  • account_id (String)

    The Zernio account ID (from /v1/accounts)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    Override which location to query. If omitted, uses the account's selected location. Use GET /gmb-locations to list valid IDs.

Returns:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 207

def get_google_business_verifications_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBVerificationsApi.get_google_business_verifications ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling GMBVerificationsApi.get_google_business_verifications"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/gmb-verifications'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'locationId'] = opts[:'location_id'] if !opts[:'location_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetGoogleBusinessVerifications200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"GMBVerificationsApi.get_google_business_verifications",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GMBVerificationsApi#get_google_business_verifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#start_google_business_verification(account_id, start_google_business_verification_request, opts = {}) ⇒ StartGoogleBusinessVerification200Response

Start a verification Starts a verification for the location. This is a mutating action: depending on method, Google mails a postcard, places a call, or sends an SMS/email to the business. Submit the resulting code with POST /gmb-verifications/verificationId/complete. Use POST /gmb-verifications/options first to discover which methods are eligible.

Parameters:

  • account_id (String)

    The Zernio account ID (from /v1/accounts)

  • start_google_business_verification_request (StartGoogleBusinessVerificationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    Override which location to target. If omitted, uses the account's selected location.

Returns:



263
264
265
266
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 263

def start_google_business_verification(, start_google_business_verification_request, opts = {})
  data, _status_code, _headers = start_google_business_verification_with_http_info(, start_google_business_verification_request, opts)
  data
end

#start_google_business_verification_with_http_info(account_id, start_google_business_verification_request, opts = {}) ⇒ Array<(StartGoogleBusinessVerification200Response, Integer, Hash)>

Start a verification Starts a verification for the location. This is a mutating action: depending on `method`, Google mails a postcard, places a call, or sends an SMS/email to the business. Submit the resulting code with POST /gmb-verifications/verificationId/complete. Use POST /gmb-verifications/options first to discover which methods are eligible.

Parameters:

  • account_id (String)

    The Zernio account ID (from /v1/accounts)

  • start_google_business_verification_request (StartGoogleBusinessVerificationRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    Override which location to target. If omitted, uses the account's selected location.

Returns:



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/zernio-sdk/api/gmb_verifications_api.rb', line 275

def start_google_business_verification_with_http_info(, start_google_business_verification_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBVerificationsApi.start_google_business_verification ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling GMBVerificationsApi.start_google_business_verification"
  end
  # verify the required parameter 'start_google_business_verification_request' is set
  if @api_client.config.client_side_validation && start_google_business_verification_request.nil?
    fail ArgumentError, "Missing the required parameter 'start_google_business_verification_request' when calling GMBVerificationsApi.start_google_business_verification"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/gmb-verifications'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'locationId'] = opts[:'location_id'] if !opts[:'location_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(start_google_business_verification_request)

  # return_type
  return_type = opts[:debug_return_type] || 'StartGoogleBusinessVerification200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"GMBVerificationsApi.start_google_business_verification",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GMBVerificationsApi#start_google_business_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end