Class: Zendesk2::Organizations
- Inherits:
-
Object
- Object
- Zendesk2::Organizations
- Extended by:
- Attributes
- Includes:
- Collection, PagedCollection, Searchable
- Defined in:
- lib/zendesk2/organizations.rb
Instance Method Summary collapse
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Searchable
Methods included from PagedCollection
#all, #all_entries, #collection_method, #collection_root, #create, #create!, #each_entry, #each_page, #get, #get!, included, #model_method, #model_root, #new_page, #next_page, #previous_page
Methods included from Collection
#all, cistern_included, #collection_method, #collection_root, #create, #create!, #get, #get!, included, #model_method, #model_root, #namespace, #new
Instance Method Details
#collection_page(params = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/zendesk2/organizations.rb', line 33 def collection_page(params = {}) collection_method = if user_id :get_user_organizations else :get_organizations end body = cistern.send(collection_method, Cistern::Hash.stringify_keys(attributes.merge(params))).body load(body[collection_root]) merge_attributes(Cistern::Hash.slice(body, 'count', 'next_page', 'previous_page')) self end |
#find_by_external_id(external_id) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/zendesk2/organizations.rb', line 15 def find_by_external_id(external_id) body = cistern.get_organization_by_external_id('external_id' => external_id).body data = body.delete('organizations') return unless data collection = clone.load(data) collection.merge_attributes(Cistern::Hash.slice(body, 'count', 'next_page', 'previous_page')) collection end |