Code Monkey home page Code Monkey logo

sdk-for-ruby's Introduction

Appwrite Ruby SDK

License Version Build Status Twitter Account Discord

This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check previous releases.

Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs

Appwrite

Installation

To install via Gem:

gem install appwrite

Getting Started

Init your SDK

Initialize your SDK with your Appwrite server API endpoint and 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
    .setSelfSigned() # Use only on dev mode with a self-signed SSL cert
;

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);

user = users.create(userId: Appwrite::ID::unique(), email: "[email protected]", phone: "+123456789", password: "password", name: "Walter O'Brien");

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
    .setSelfSigned() # Use only on dev mode with a self-signed SSL cert
;

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

user = users.create(userId: Appwrite::ID::unique(), email: "[email protected]", phone: "+123456789", password: "password", name: "Walter O'Brien");

Error Handling

The Appwrite Ruby SDK raises Appwrite::Exception object with message, code and response properties. You can handle any errors by catching Appwrite::Exception and present the message to the user or handle it yourself based on the provided error information. Below is an example.

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

begin
    user = users.create(userId: Appwrite::ID::unique(), email: "[email protected]", phone: "+123456789", password: "password", name: "Walter O'Brien");
rescue Appwrite::Exception => error
    puts error.message
end

Learn more

You can use the following resources to learn more and get help

Contribution

This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.

License

Please see the BSD-3-Clause license file for more information.

sdk-for-ruby's People

Contributors

abnegate avatar christyjacob4 avatar eldadfux avatar lohanidamodar avatar matteogheza avatar stnguyen90 avatar torstendittmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk-for-ruby's Issues

Upgrade our issue templates to use GitHub issue forms โœ๏ธ

Introduction

GitHub has recently rolled out a public beta for their issue forms feature. This would allow you to create interactive issue templates and validate them ๐Ÿคฏ.

Appwrite currently uses the older issue template format. Your task is to create GitHub issue forms for this repository. Please use Appwrite's issue templates as a reference for this PR.

Tasks summary:

  • Fork & clone this repository
  • Prepare bug report issue form in .github/ISSUE_TEMPLATE/bug.yaml
  • Prepare documentation issue form in .github/ISSUE_TEMPLATE/documentation.yaml
  • Prepare feature request issue form in .github/ISSUE_TEMPLATE/feature.yaml
  • Push changes to master and test issue forms on your fork
  • Submit pull request

If you need any help, reach out to us on our Discord server.

Are you ready to work on this issue? ๐Ÿค” Let us know, and we will assign it to you ๐Ÿ˜Š

Happy Appwriting!

๐Ÿ“š Documentation: Update Ruby install command per Appwrite Docs

๐Ÿ’ญ Description

Per this issue and this PR in the Appwrite Docs repo, the Ruby gem install command should be gem install appwrite instead of gem install appwrite --save.

A PR will be submitted to update this in Readme.md.

I do see that this repo is marked as Read Only in the About section on GitHub., If this repo is automatically generated by pushing to a different repo, please let me know and I can make this change upstream instead. ๐Ÿ‘

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

Client raises TypeError when API responds with 204

Hi!
SDK raises exception when calling Appwrite::Database#delete_document because API endpoint responds with 204 No Content without body, but Appwrite::Client expects JSON and tries to parse it.

Ruby version: 3.0.2
SDK version: 2.4.0

Trace:

/Users/anna/.rbenv/versions/3.0.2/lib/ruby/3.0.0/json/common.rb:216:in `initialize': no implicit conversion of nil into String (TypeError)
	from /Users/anna/.rbenv/versions/3.0.2/lib/ruby/3.0.0/json/common.rb:216:in `new'
	from /Users/anna/.rbenv/versions/3.0.2/lib/ruby/3.0.0/json/common.rb:216:in `parse'
	from /Users/anna/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/appwrite-2.4.0/lib/appwrite/client.rb:110:in `fetch'
	from /Users/anna/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/appwrite-2.4.0/lib/appwrite/client.rb:67:in `call'
	from /Users/anna/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/appwrite-2.4.0/lib/appwrite/services/database.rb:294:in `delete_document'

I suppose it is common problem for all DELETE endpoints such as Appwrite::Database#delete_document, Appwrite::Storage#delete_file, Appwrite::Storage#delete_collection

I could try to fix and open PR if it's ok)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.