1
0
Fork 0
mirror of synced 2024-06-03 11:24:48 +12:00
appwrite/docs/sdks/ruby/GETTING_STARTED.md
2021-03-23 13:50:40 +05:45

1.5 KiB

Getting Started

Init your SDK

Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section.

require 'appwrite'

client = Appwrite::Client.new()

client
    .set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
    .set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
    .set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
;

Make Your First Request

Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.

users = Appwrite::Users.new(client);

result = users.create(email: 'email@example.com', password: 'password');

Full Example

require 'appwrite'

client = Appwrite::Client.new()

client
    .set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
    .set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
    .set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
;

users = Appwrite::Users.new(client);

result = users.create(email: 'email@example.com', password: 'password');

Learn more

You can use followng resources to learn more and get help