Class: Syncano::Clients::Base
- Inherits:
-
Object
- Object
- Syncano::Clients::Base
- Defined in:
- lib/syncano/clients/base.rb
Overview
Base class for representing clients
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#auth_key ⇒ Object
readonly
Returns the value of attribute auth_key.
-
#instance_name ⇒ Object
readonly
Returns the value of attribute instance_name.
Instance Method Summary collapse
-
#admins ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Admin objects.
-
#api_keys ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::ApiKey objects.
-
#collections(project_id) ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Project objects.
-
#data_objects(project_id, collection_id) ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::DataObject objects.
-
#folders(project_id, collection_id) ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Folder objects.
-
#initialize(instance_name, api_key, auth_key) ⇒ Base
constructor
Constructor for Syncano::Clients::Base object.
-
#logout ⇒ TrueClass, FalseClass
Deletes saved auth_key.
-
#make_batch_request(batch_client, resource_name, method_name, params = {}) ⇒ Object
Performs batch request to Syncano api This should be overwritten in inherited classes.
-
#make_request(resource_name, method_name, params = {}, response_key = nil) ⇒ Syncano::Response
Performs request to Syncano api This should be overwritten in inherited classes.
-
#projects ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Project objects.
-
#roles ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Role objects.
-
#users ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::User objects.
Constructor Details
#initialize(instance_name, api_key, auth_key) ⇒ Base
Constructor for Syncano::Clients::Base object
11 12 13 14 15 16 17 |
# File 'lib/syncano/clients/base.rb', line 11 def initialize(instance_name, api_key, auth_key) super() self.instance_name = instance_name self.api_key = api_key self.auth_key = auth_key if auth_key.present? end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/syncano/clients/base.rb', line 6 def api_key @api_key end |
#auth_key ⇒ Object
Returns the value of attribute auth_key.
6 7 8 |
# File 'lib/syncano/clients/base.rb', line 6 def auth_key @auth_key end |
#instance_name ⇒ Object
Returns the value of attribute instance_name.
6 7 8 |
# File 'lib/syncano/clients/base.rb', line 6 def instance_name @instance_name end |
Instance Method Details
#admins ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Admin objects
28 29 30 |
# File 'lib/syncano/clients/base.rb', line 28 def admins ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Admin) end |
#api_keys ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::ApiKey objects
34 35 36 |
# File 'lib/syncano/clients/base.rb', line 34 def api_keys ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::ApiKey) end |
#collections(project_id) ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Project objects
53 54 55 |
# File 'lib/syncano/clients/base.rb', line 53 def collections(project_id) ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Collection, project_id: project_id) end |
#data_objects(project_id, collection_id) ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::DataObject objects
69 70 71 |
# File 'lib/syncano/clients/base.rb', line 69 def data_objects(project_id, collection_id) ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::DataObject, project_id: project_id, collection_id: collection_id) end |
#folders(project_id, collection_id) ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Folder objects
61 62 63 |
# File 'lib/syncano/clients/base.rb', line 61 def folders(project_id, collection_id) ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Collection, project_id: project_id, collection_id: collection_id) end |
#logout ⇒ TrueClass, FalseClass
Deletes saved auth_key
21 22 23 24 |
# File 'lib/syncano/clients/base.rb', line 21 def logout self.auth_key = nil self.auth_key.nil? end |
#make_batch_request(batch_client, resource_name, method_name, params = {}) ⇒ Object
Performs batch request to Syncano api This should be overwritten in inherited classes
97 98 |
# File 'lib/syncano/clients/base.rb', line 97 def make_batch_request(batch_client, resource_name, method_name, params = {}) end |
#make_request(resource_name, method_name, params = {}, response_key = nil) ⇒ Syncano::Response
Performs request to Syncano api This should be overwritten in inherited classes
88 89 |
# File 'lib/syncano/clients/base.rb', line 88 def make_request(resource_name, method_name, params = {}, response_key = nil) end |
#projects ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Project objects
46 47 48 |
# File 'lib/syncano/clients/base.rb', line 46 def projects ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Project) end |
#roles ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::Role objects
40 41 42 |
# File 'lib/syncano/clients/base.rb', line 40 def roles ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Role) end |
#users ⇒ Syncano::QueryBuilder
Returns query builder for Syncano::Resources::User objects
77 78 79 |
# File 'lib/syncano/clients/base.rb', line 77 def users ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User) end |