Class: Syncano::Resources::Folder

Inherits:
Base
  • Object
show all
Defined in:
lib/syncano/resources/folder.rb

Overview

Folder resource

Instance Attribute Summary

Attributes inherited from Base

#attributes, #destroyed, #id

Class Method Summary collapse

Instance Method Summary collapse

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_name(client, name, scope_parameters = {}, conditions = {}) ⇒ Syncano::Resources::Folder

Wrapper for api “get_one” method with folder_name as a key

Parameters:

  • client (Syncano::Clients::Base)
  • name (String)
  • scope_parameters (Hash) (defaults to: {})
  • conditions (Hash) (defaults to: {})

Returns:



17
18
19
# File 'lib/syncano/resources/folder.rb', line 17

def self.find_by_name(client, name, scope_parameters = {}, conditions = {})
  find(client, name, scope_parameters, conditions)
end

Instance Method Details

#authorize(api_client_id, permission) ⇒ Syncano::Resources::Base

Wrapper for api “authorize” method

Parameters:

  • api_client_id (Integer)
  • permission (String)

Returns:



25
26
27
28
# File 'lib/syncano/resources/folder.rb', line 25

def authorize(api_client_id, permission)
  perform_authorize(nil, api_client_id: api_client_id, permission: permission)
  self
end

#batch_authorize(batch_client, api_client_id, permission) ⇒ Syncano::Resources::Base

Wrapper for api “authorize” method

Parameters:

  • batch_client (Jimson::BatchClient)
  • api_client_id (Integer)
  • permission (String)

Returns:



35
36
37
38
# File 'lib/syncano/resources/folder.rb', line 35

def batch_authorize(batch_client, api_client_id, permission)
  perform_authorize(batch_client, api_client_id: api_client_id, permission: permission)
  self
end

#batch_deauthorize(batch_client, api_client_id, permission) ⇒ Syncano::Resources::Base

Wrapper for api “deauthorize” method

Parameters:

  • batch_client (Jimson::BatchClient)
  • api_client_id (Integer)
  • permission (String)

Returns:



54
55
56
57
# File 'lib/syncano/resources/folder.rb', line 54

def batch_deauthorize(batch_client, api_client_id, permission)
  perform_deauthorize(batch_client, api_client_id: api_client_id, permission: permission)
  self
end

#data_objectsSyncano::QueryBuilder

Association has_many :data_objects

Returns:



7
8
9
# File 'lib/syncano/resources/folder.rb', line 7

def data_objects
  ::Syncano::QueryBuilder.new(client, ::Syncano::Resources::DataObject, scope_parameters.merge(folders: @saved_attributes[:name]))
end

#deauthorize(api_client_id, permission) ⇒ Syncano::Resources::Base

Wrapper for api “deauthorize” method

Parameters:

  • api_client_id (Integer)
  • permission (String)

Returns:



44
45
46
47
# File 'lib/syncano/resources/folder.rb', line 44

def deauthorize(api_client_id, permission)
  perform_deauthorize(nil, api_client_id: api_client_id, permission: permission)
  self
end