class Syncano::Resources::Project

Project resource

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/project.rb, line 29
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/project.rb, line 39
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/project.rb, line 58
def batch_deauthorize(batch_client, api_client_id, permission)
  perform_deauthorize(batch_client, api_client_id: api_client_id, permission: permission)
  self
end
collections() click to toggle source

Association has_many :collections @return [Syncano::QueryBuilder] query builder for resource Syncano::Resources::Collection

# File lib/syncano/resources/project.rb, line 7
def collections
  ::Syncano::QueryBuilder.new(client, ::Syncano::Resources::Collection, project_id: id)
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/project.rb, line 48
def deauthorize(api_client_id, permission)
  perform_deauthorize(nil, api_client_id: api_client_id, permission: permission)
  self
end
subscribe() click to toggle source

Wrapper for api “subscription.subscribe_project” method @return [Syncano::Resource::Project]

# File lib/syncano/resources/project.rb, line 13
def subscribe
  perform_subscribe
  reload!
end
unsubscribe() click to toggle source

Wrapper for api “subscription.unsubscribe_project” method @return [Syncano::Resource::Project]

# File lib/syncano/resources/project.rb, line 20
def unsubscribe
  perform_unsubscribe
  reload!
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/project.rb, line 83
def perform_authorize(batch_client, parameters)
  self.class.make_request(client, batch_client, :authorize, 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/project.rb, line 91
def perform_deauthorize(batch_client, parameters)
  self.class.make_request(client, batch_client, :deauthorize, parameters.merge(self.class.primary_key_name.to_sym => primary_key))
end
perform_subscribe() click to toggle source

Executes proper subscribe request @return [Syncano::Response]

# File lib/syncano/resources/project.rb, line 67
def perform_subscribe
  check_if_sync_client!
  client.make_request(:subscription, :subscribe_project, { project_id: id })
end
perform_unsubscribe() click to toggle source

Executes proper unsubscribe request @return [Syncano::Response]

# File lib/syncano/resources/project.rb, line 74
def perform_unsubscribe
  check_if_sync_client!
  client.make_request(:subscription, :unsubscribe_project, { project_id: id })
end