class Syncano::Resources::Folder

Folder resource

Public Class Methods

find_by_name(client, name, scope_parameters = {}, conditions = {}) click to toggle source

Wrapper for api “get_one” method with folder_name as a key @param [Syncano::Clients::Base] client @param [String] name @param [Hash] scope_parameters @param [Hash] conditions @return [Syncano::Resources::Folder]

# 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

Public Instance Methods

authorize(api_client_id, permission) click to toggle source

Wrapper for api “authorize” method @param [Integer] api_client_id @param [String] permission @return [Syncano::Resources::Base]

# 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) click to toggle source

Wrapper for api “authorize” method @param [Jimson::BatchClient] batch_client @param [Integer] api_client_id @param [String] permission @return [Syncano::Resources::Base]

# 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) click to toggle source

Wrapper for api “deauthorize” method @param [Jimson::BatchClient] batch_client @param [Integer] api_client_id @param [String] permission @return [Syncano::Resources::Base]

# 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_objects() click to toggle source

Association has_many :data_objects @return [Syncano::QueryBuilder] query builder for resource Syncano::Resources::DataObject

# 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) click to toggle source

Wrapper for api “deauthorize” method @param [Integer] api_client_id @param [String] permission @return [Syncano::Resources::Base]

# 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

Private Instance Methods

perform_authorize(batch_client, parameters) click to toggle source

Executes proper authorize request @param [Jimson::BatchClient] batch_client @param [Hash] parameters @return [Syncano::Response]

# File lib/syncano/resources/folder.rb, line 75
def perform_authorize(batch_client, parameters)
  self.class.make_request(client, batch_client, :authorize, scope_parameters.merge(parameters.merge(self.class.primary_key_name.to_sym => primary_key)))
end
perform_deauthorize(batch_client, parameters) click to toggle source

Executes proper deauthorize request @param [Jimson::BatchClient] batch_client @param [Hash] parameters @return [Syncano::Response]

# File lib/syncano/resources/folder.rb, line 83
def perform_deauthorize(batch_client, parameters)
  self.class.make_request(client, batch_client, :deauthorize, scope_parameters.merge(parameters.merge(self.class.primary_key_name.to_sym => primary_key)))
end
perform_destroy(batch_client) click to toggle source

Executes proper destroy request @param [Jimson::BatchClient] batch_client @return [Syncano::Response]

# File lib/syncano/resources/folder.rb, line 67
def perform_destroy(batch_client)
  self.class.make_request(client, batch_client, :destroy, scope_parameters.merge(name: primary_key))
end