Class: Readiness::Zendesk::Locales
- Defined in:
- lib/support_readiness/zendesk/locales.rb
Overview
Defines the class Locales within the module Readiness::Zendesk.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.find!(client, lid) ⇒ Object
Locates a locale within Zendesk.
-
.list(client) ⇒ Array
Lists locales.
Instance Method Summary collapse
-
#initialize(object = {}) ⇒ Locales
constructor
Creates a new Locales instance.
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
#initialize(object = {}) ⇒ Locales
Creates a new Readiness::Zendesk::Locales instance
24 25 26 27 28 |
# File 'lib/support_readiness/zendesk/locales.rb', line 24 def initialize(object = {}) @id = object['id'] @locale = object['locale'] @name = object['name'] end |
Instance Attribute Details
#id ⇒ Object
13 14 15 |
# File 'lib/support_readiness/zendesk/locales.rb', line 13 def id @id end |
#locale ⇒ Object
13 14 15 |
# File 'lib/support_readiness/zendesk/locales.rb', line 13 def locale @locale end |
#name ⇒ Object
13 14 15 |
# File 'lib/support_readiness/zendesk/locales.rb', line 13 def name @name end |
Class Method Details
.find!(client, lid) ⇒ Object
Locates a locale within Zendesk. This will exit on error
74 75 76 77 78 |
# File 'lib/support_readiness/zendesk/locales.rb', line 74 def self.find!(client, lid) response = client.connection.get("locales/#{lid}") handle_request_error(1, 'Zendesk', response.status, { action: 'Find locale', id: lid }) unless response.status == 200 Locales.new(Oj.load(response.body)['locale']) end |
.list(client) ⇒ Array
Lists locales.
48 49 50 51 52 53 |
# File 'lib/support_readiness/zendesk/locales.rb', line 48 def self.list(client) response = client.connection.get('locales') handle_request_error(0, 'Zendesk', response.status) unless response.status == 200 body = Oj.load(response.body) body['locales'].map { |l| Locales.new(l) } end |