Class: ZendeskAPI::Setting
- Inherits:
-
UpdateResource
- Object
- Data
- DataResource
- UpdateResource
- ZendeskAPI::Setting
- Defined in:
- lib/zendesk_api/resources.rb
Instance Attribute Summary collapse
-
#on ⇒ Object
readonly
Returns the value of attribute on.
Attributes inherited from DataResource
Attributes inherited from Data
#association, #attributes, #errors, #response
Instance Method Summary collapse
- #attributes_for_save ⇒ Object
-
#initialize(client, attributes = {}) ⇒ Setting
constructor
A new instance of Setting.
- #new_record? ⇒ Boolean
- #path(options = {}) ⇒ Object
Methods included from Update
Methods included from Save
#clear_associations, #save, #save!, #save_associations
Methods included from ResponseHandler
Methods inherited from DataResource
Methods included from Verbs
Methods inherited from Data
#==, #account_data, #id, inherited, #inspect, #loaded_associations, #method_missing, namespace, new_from_response, #refresh_custom_fields_metadata, resource_name, resource_path, #respond_to_missing?, singular_resource_name, subclasses, #to_json, #to_s
Methods included from Associations
Constructor Details
#initialize(client, attributes = {}) ⇒ Setting
Returns a new instance of Setting.
353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/zendesk_api/resources.rb', line 353 def initialize(client, attributes = {}) # Try and find the root key @on = (attributes.keys.map(&:to_s) - %w[association options]).first # Namespaced settings (e.g. "lotus", "admin_center") nest their values in a # Hash, which we hoist up to be the root attributes. Some settings are # top-level scalars or arrays (e.g. "shared_views_order", # "agent_home_pinned_views") - leave those under @on rather than merging, # which would raise "no implicit conversion of Array into Hash". attributes.merge!(attributes.delete(@on)) if attributes[@on].is_a?(Hash) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data
Instance Attribute Details
#on ⇒ Object (readonly)
Returns the value of attribute on.
351 352 353 |
# File 'lib/zendesk_api/resources.rb', line 351 def on @on end |
Instance Method Details
#attributes_for_save ⇒ Object
375 376 377 |
# File 'lib/zendesk_api/resources.rb', line 375 def attributes_for_save {self.class.resource_name => {@on => attributes.changes}} end |
#new_record? ⇒ Boolean
367 368 369 |
# File 'lib/zendesk_api/resources.rb', line 367 def new_record? false end |
#path(options = {}) ⇒ Object
371 372 373 |
# File 'lib/zendesk_api/resources.rb', line 371 def path( = {}) super(.merge(with_parent: true)) end |