Class: Syncano::Resources::Project

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

Overview

Project resource

Instance Attribute Summary

Attributes inherited from Base

#attributes, #destroyed, #id

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

Instance Method Details

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

Wrapper for api “authorize” method

Parameters:

  • api_client_id (Integer)
  • permission (String)

Returns:



29
30
31
32
# 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) ⇒ Syncano::Resources::Base

Wrapper for api “authorize” method

Parameters:

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

Returns:



39
40
41
42
# 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) ⇒ Syncano::Resources::Base

Wrapper for api “deauthorize” method

Parameters:

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

Returns:



58
59
60
61
# 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

#collectionsSyncano::QueryBuilder

Association has_many :collections

Returns:



7
8
9
# 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) ⇒ Syncano::Resources::Base

Wrapper for api “deauthorize” method

Parameters:

  • api_client_id (Integer)
  • permission (String)

Returns:



48
49
50
51
# 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

#subscribeSyncano::Resource::Project

Wrapper for api “subscription.subscribe_project” method

Returns:

  • (Syncano::Resource::Project)


13
14
15
16
# File 'lib/syncano/resources/project.rb', line 13

def subscribe
  perform_subscribe
  reload!
end

#unsubscribeSyncano::Resource::Project

Wrapper for api “subscription.unsubscribe_project” method

Returns:

  • (Syncano::Resource::Project)


20
21
22
23
# File 'lib/syncano/resources/project.rb', line 20

def unsubscribe
  perform_unsubscribe
  reload!
end