Class: Syncano::Resources::Collection
- Defined in:
- lib/syncano/resources/collection.rb
Overview
Collection resource
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.find_by_key(client, key, scope_parameters = {}, conditions = {}) ⇒ Syncano::Resources::Collection
Wrapper for api “get_one” method with collection_key as a key.
Instance Method Summary collapse
-
#activate(force = false) ⇒ Syncano::Resources::Collection
Wrapper for api “activate” method.
-
#add_tag(tags, weight = 1, remove_other = false) ⇒ Syncano::Resources::Collection
Wrapper for api “add_tag” method.
-
#authorize(api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “authorize” method.
-
#batch_activate(batch_client, force = false) ⇒ Syncano::Response
Batch version of “activate” method.
-
#batch_add_tags(batch_client, tags, weight = 1, remove_other = false) ⇒ Syncano::Response
Batch version of “add_tags” method.
-
#batch_authorize(batch_client, api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “authorize” method.
-
#batch_deactivate(batch_client) ⇒ Syncano::Response
Batch version of “deactivate” method.
-
#batch_deauthorize(batch_client, api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “deauthorize” method.
-
#batch_delete_tag(batch_client, tags) ⇒ Syncano::Response
Batch version of “delete_tag” method.
-
#data_objects ⇒ Syncano::QueryBuilder
Association has_many :data_objects.
-
#deactivate ⇒ Syncano::Resources::Collection
Wrapper for api “deactivate” method.
-
#deauthorize(api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “deauthorize” method.
-
#delete_tags(tags) ⇒ Syncano::Resources::Collection
Wrapper for api “delete_tag” method.
-
#folders ⇒ Syncano::QueryBuilder
Association has_many :folders.
-
#subscribe ⇒ Syncano::Resource::Collection
Wrapper for api “subscription.subscribe_collection” method.
-
#unsubscribe ⇒ Syncano::Resource::Collection
Wrapper for api “subscription.unsubscribe_collection” method.
-
#users ⇒ Syncano::QueryBuilder
Association has_many :users.
Methods inherited from Base
#[], #[]=, all, #batch, batch_create, #batch_destroy, #batch_save, #batch_update, count, create, #destroy, #destroyed?, find, #initialize, #new_record?, #reload!, #save, #saved?, #update
Constructor Details
This class inherits a constructor from Syncano::Resources::Base
Class Method Details
.find_by_key(client, key, scope_parameters = {}, conditions = {}) ⇒ Syncano::Resources::Collection
Wrapper for api “get_one” method with collection_key as a key
29 30 31 |
# File 'lib/syncano/resources/collection.rb', line 29 def self.find_by_key(client, key, scope_parameters = {}, conditions = {}) perform_find(client, :key, key, scope_parameters, conditions) end |
Instance Method Details
#activate(force = false) ⇒ Syncano::Resources::Collection
Wrapper for api “activate” method
36 37 38 39 40 41 |
# File 'lib/syncano/resources/collection.rb', line 36 def activate(force = false) response = perform_activate(nil, force) reload! if response.status self end |
#add_tag(tags, weight = 1, remove_other = false) ⇒ Syncano::Resources::Collection
Wrapper for api “add_tag” method
72 73 74 75 76 77 |
# File 'lib/syncano/resources/collection.rb', line 72 def add_tag(, weight = 1, remove_other = false) response = perform_add_tag(nil, , weight, remove_other) reload! if response.status self end |
#authorize(api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “authorize” method
125 126 127 128 |
# File 'lib/syncano/resources/collection.rb', line 125 def (api_client_id, ) (nil, api_client_id: api_client_id, permission: ) self end |
#batch_activate(batch_client, force = false) ⇒ Syncano::Response
Batch version of “activate” method
47 48 49 |
# File 'lib/syncano/resources/collection.rb', line 47 def batch_activate(batch_client, force = false) perform_activate(batch_client, force) end |
#batch_add_tags(batch_client, tags, weight = 1, remove_other = false) ⇒ Syncano::Response
Batch version of “add_tags” method
85 86 87 |
# File 'lib/syncano/resources/collection.rb', line 85 def (batch_client, , weight = 1, remove_other = false) perform_add_tag(batch_client, , weight, remove_other) end |
#batch_authorize(batch_client, api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “authorize” method
135 136 137 138 |
# File 'lib/syncano/resources/collection.rb', line 135 def (batch_client, api_client_id, ) (batch_client, api_client_id: api_client_id, permission: ) self end |
#batch_deactivate(batch_client) ⇒ Syncano::Response
Batch version of “deactivate” method
63 64 65 |
# File 'lib/syncano/resources/collection.rb', line 63 def batch_deactivate(batch_client) perform_deactivate(batch_client) end |
#batch_deauthorize(batch_client, api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “deauthorize” method
154 155 156 157 |
# File 'lib/syncano/resources/collection.rb', line 154 def (batch_client, api_client_id, ) (batch_client, api_client_id: api_client_id, permission: ) self end |
#batch_delete_tag(batch_client, tags) ⇒ Syncano::Response
Batch version of “delete_tag” method
103 104 105 |
# File 'lib/syncano/resources/collection.rb', line 103 def batch_delete_tag(batch_client, ) perform_delete_tag(batch_client, ) end |
#data_objects ⇒ Syncano::QueryBuilder
Association has_many :data_objects
13 14 15 |
# File 'lib/syncano/resources/collection.rb', line 13 def data_objects ::Syncano::QueryBuilder.new(client, ::Syncano::Resources::DataObject, scope_parameters.merge(collection_id: id)) end |
#deactivate ⇒ Syncano::Resources::Collection
Wrapper for api “deactivate” method
53 54 55 56 57 58 |
# File 'lib/syncano/resources/collection.rb', line 53 def deactivate response = perform_deactivate(nil) reload! if response.status self end |
#deauthorize(api_client_id, permission) ⇒ Syncano::Resources::Base
Wrapper for api “deauthorize” method
144 145 146 147 |
# File 'lib/syncano/resources/collection.rb', line 144 def (api_client_id, ) (nil, api_client_id: api_client_id, permission: ) self end |
#delete_tags(tags) ⇒ Syncano::Resources::Collection
Wrapper for api “delete_tag” method
92 93 94 95 96 97 |
# File 'lib/syncano/resources/collection.rb', line 92 def () response = perform_delete_tag(nil, ) reload! if response.status self end |
#folders ⇒ Syncano::QueryBuilder
Association has_many :folders
7 8 9 |
# File 'lib/syncano/resources/collection.rb', line 7 def folders ::Syncano::QueryBuilder.new(client, ::Syncano::Resources::Folder, scope_parameters.merge(collection_id: id)) end |
#subscribe ⇒ Syncano::Resource::Collection
Wrapper for api “subscription.subscribe_collection” method
109 110 111 112 |
# File 'lib/syncano/resources/collection.rb', line 109 def subscribe perform_subscribe reload! end |
#unsubscribe ⇒ Syncano::Resource::Collection
Wrapper for api “subscription.unsubscribe_collection” method
116 117 118 119 |
# File 'lib/syncano/resources/collection.rb', line 116 def unsubscribe perform_unsubscribe reload! end |
#users ⇒ Syncano::QueryBuilder
Association has_many :users
19 20 21 |
# File 'lib/syncano/resources/collection.rb', line 19 def users ::Syncano::QueryBuilder.new(client, ::Syncano::Resources::User, scope_parameters.merge(collection_id: id)) end |