Class: Zernio::GMBAttributesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ GMBAttributesApi

Returns a new instance of GMBAttributesApi.



19
20
21
# File 'lib/zernio-sdk/api/gmb_attributes_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_attributes_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_gmb_attribute_metadata(account_id, opts = {}) ⇒ GetGmbAttributeMetadata200Response

Get attribute metadata Returns metadata about which Google Business Profile attributes are available for a location or business category. Use this endpoint to discover valid attribute names, value types, and allowed enum values before reading or writing via gmb-attributes. Two mutually exclusive query modes: Location mode: pass locationId (or rely on the account's stored selectedLocationId). Google returns attributes valid for that specific location. Category mode: pass categoryName (must start with categories/) and regionCode. Google returns attributes valid for that category across the given region. languageCode is optional in category mode. Both modes support pageSize and pageToken for pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    GBP location ID (e.g. "6257659026299438786"). If omitted, uses the account's stored selectedLocationId. Mutually exclusive with categoryName.

  • :category_name (String)

    Category resource name, must start with "categories/" (e.g. "categories/gcid:plumber"). Required together with regionCode. Mutually exclusive with locationId.

  • :region_code (String)

    BCP-47 region code (e.g. "US", "ES"). Required when categoryName is provided.

  • :language_code (String)

    BCP-47 language code for display names (e.g. "en", "es"). Optional when categoryName is provided. Omitted from the Google call when not supplied.

  • :page_size (Integer)

    Maximum number of attribute metadata items to return. Google defaults to 200.

  • :page_token (String)

    Pagination token from a previous response's nextPageToken field.

Returns:



33
34
35
36
# File 'lib/zernio-sdk/api/gmb_attributes_api.rb', line 33

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

#get_gmb_attribute_metadata_with_http_info(account_id, opts = {}) ⇒ Array<(GetGmbAttributeMetadata200Response, Integer, Hash)>

Get attribute metadata Returns metadata about which Google Business Profile attributes are available for a location or business category. Use this endpoint to discover valid attribute names, value types, and allowed enum values before reading or writing via gmb-attributes. Two mutually exclusive query modes: Location mode: pass `locationId` (or rely on the account's stored `selectedLocationId`). Google returns attributes valid for that specific location. Category mode: pass `categoryName` (must start with `categories/`) and `regionCode`. Google returns attributes valid for that category across the given region. `languageCode` is optional in category mode. Both modes support `pageSize` and `pageToken` for pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :location_id (String)

    GBP location ID (e.g. &quot;6257659026299438786&quot;). If omitted, uses the account's stored selectedLocationId. Mutually exclusive with categoryName.

  • :category_name (String)

    Category resource name, must start with &quot;categories/&quot; (e.g. &quot;categories/gcid:plumber&quot;). Required together with regionCode. Mutually exclusive with locationId.

  • :region_code (String)

    BCP-47 region code (e.g. &quot;US&quot;, &quot;ES&quot;). Required when categoryName is provided.

  • :language_code (String)

    BCP-47 language code for display names (e.g. &quot;en&quot;, &quot;es&quot;). Optional when categoryName is provided. Omitted from the Google call when not supplied.

  • :page_size (Integer)

    Maximum number of attribute metadata items to return. Google defaults to 200.

  • :page_token (String)

    Pagination token from a previous response's nextPageToken field.

Returns:



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
108
109
# File 'lib/zernio-sdk/api/gmb_attributes_api.rb', line 49

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBAttributesApi.get_gmb_attribute_metadata ...'
  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 GMBAttributesApi.get_gmb_attribute_metadata"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 200
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling GMBAttributesApi.get_gmb_attribute_metadata, must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling GMBAttributesApi.get_gmb_attribute_metadata, must be greater than or equal to 1.'
  end

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

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'locationId'] = opts[:'location_id'] if !opts[:'location_id'].nil?
  query_params[:'categoryName'] = opts[:'category_name'] if !opts[:'category_name'].nil?
  query_params[:'regionCode'] = opts[:'region_code'] if !opts[:'region_code'].nil?
  query_params[:'languageCode'] = opts[:'language_code'] if !opts[:'language_code'].nil?
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'pageToken'] = opts[:'page_token'] if !opts[:'page_token'].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] || 'GetGmbAttributeMetadata200Response'

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

  new_options = opts.merge(
    :operation => :"GMBAttributesApi.get_gmb_attribute_metadata",
    :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: GMBAttributesApi#get_gmb_attribute_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_google_business_attributes(account_id, opts = {}) ⇒ GetGoogleBusinessAttributes200Response

Get attributes Returns GBP location attributes (amenities, services, accessibility, payment types). Available attributes vary by business category.

Parameters:

  • account_id (String)
  • 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:



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

def get_google_business_attributes(, opts = {})
  data, _status_code, _headers = get_google_business_attributes_with_http_info(, opts)
  data
end

#get_google_business_attributes_with_http_info(account_id, opts = {}) ⇒ Array<(GetGoogleBusinessAttributes200Response, Integer, Hash)>

Get attributes Returns GBP location attributes (amenities, services, accessibility, payment types). Available attributes vary by business category.

Parameters:

  • account_id (String)
  • 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:



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
# File 'lib/zernio-sdk/api/gmb_attributes_api.rb', line 128

def get_google_business_attributes_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBAttributesApi.get_google_business_attributes ...'
  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 GMBAttributesApi.get_google_business_attributes"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/gmb-attributes'.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] || 'GetGoogleBusinessAttributes200Response'

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

  new_options = opts.merge(
    :operation => :"GMBAttributesApi.get_google_business_attributes",
    :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: GMBAttributesApi#get_google_business_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_google_business_attributes(account_id, update_google_business_attributes_request, opts = {}) ⇒ UpdateGoogleBusinessAttributes200Response

Update attributes Updates location attributes (amenities, services, etc.). The attributeMask specifies which attributes to update (comma-separated).

Parameters:

Options Hash (opts):

  • :location_id (String)

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

Returns:



184
185
186
187
# File 'lib/zernio-sdk/api/gmb_attributes_api.rb', line 184

def update_google_business_attributes(, update_google_business_attributes_request, opts = {})
  data, _status_code, _headers = update_google_business_attributes_with_http_info(, update_google_business_attributes_request, opts)
  data
end

#update_google_business_attributes_with_http_info(account_id, update_google_business_attributes_request, opts = {}) ⇒ Array<(UpdateGoogleBusinessAttributes200Response, Integer, Hash)>

Update attributes Updates location attributes (amenities, services, etc.). The attributeMask specifies which attributes to update (comma-separated).

Parameters:

Options Hash (opts):

  • :location_id (String)

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

Returns:



196
197
198
199
200
201
202
203
204
205
206
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
# File 'lib/zernio-sdk/api/gmb_attributes_api.rb', line 196

def update_google_business_attributes_with_http_info(, update_google_business_attributes_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GMBAttributesApi.update_google_business_attributes ...'
  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 GMBAttributesApi.update_google_business_attributes"
  end
  # verify the required parameter 'update_google_business_attributes_request' is set
  if @api_client.config.client_side_validation && update_google_business_attributes_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_google_business_attributes_request' when calling GMBAttributesApi.update_google_business_attributes"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/gmb-attributes'.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(update_google_business_attributes_request)

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

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

  new_options = opts.merge(
    :operation => :"GMBAttributesApi.update_google_business_attributes",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GMBAttributesApi#update_google_business_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end