README.md in syncano-3.1.1.beta vs README.md in syncano-3.1.1.beta2

- old
+ new

@@ -1,26 +1,26 @@ # Syncano -Syncano ruby gem provides communication with Syncano ([www.syncano.com](www.syncano.com)) via HTTPS RESTful interface and TCP sockets. +Syncano ruby gem provides communication with Syncano ([www.syncano.com](http://www.syncano.com)) via HTTPS RESTful interface and TCP sockets. The full source code can be found on [Github](https://github.com/Syncano/syncano-ruby) - feel free to browse or contribute. -Click here to learn more about [Syncano](www.syncano.com) or [create an account](https://login.syncano.com/sign_up)! +Click here to learn more about [Syncano](http://www.syncano.com) or [create an account](https://login.syncano.com/sign_up)! ## Installation Add this line to your application's Gemfile: - gem 'syncano' + gem 'syncano', '~> 3.1.1.beta2' And then execute: $ bundle Or install it yourself as: - $ gem install syncano + $ gem install syncano -v 3.1.1.beta2 --pre At the end generate initializer with api key and api instance name: $ rails g syncano:install @@ -54,10 +54,22 @@ client.reconnect client.disconnect ``` * managing callbacks for handling notifications (it is described later in this document) +#### User api key + +If you want to use an user api key, you have to pass auth key or username and password to the client's constructor. + +```ruby +client = Syncano.client(api_key: 'api key', instance_name: 'instance name', auth_key: 'auth key') +``` + +```ruby +client = Syncano.client(api_key: 'api key', instance_name: 'instance name', username: 'username', password: 'password') +``` + ### Resources Syncano gem utilizes an ActiveRecord pattern for managing resources. You can use it in similar way with both type of clients. Below is a list of standard methods implemented in resources. @@ -83,12 +95,14 @@ Below is a list of all implemented resources with information about what methods are implemented and usage examples. #### Project -Implements all standard methods. +Implements all standard methods and following custom: +* project.authorize(api_key_id, permission) + ##### Examples * Getting all projects ```ruby @@ -106,19 +120,26 @@ ```ruby project[:description] = 'Lorem ipsum' project.save ``` +* Authorizing user api key with read permission + +```ruby +project.authorize(api_key_id, 'read_data') +``` + #### Collection Implements all standard methods and following custom: * collections.find_by_key(collection_key) * collection.activate * collection.deactivate * collection.add_tag(tag, weight, remove_others) * collection.delete_tag(tag) +* collection.authorize(api_key_id, permission) ##### Examples * Getting all @@ -148,9 +169,10 @@ #### Folder Implements all standard methods and following custom: * folders.find_by_name(folder_name) +* folder.authorize(api_key_id, permission) Find method uses folder name as a key. ##### Examples