Skip to content

Commit

Permalink
Merge pull request #3 from appwrite/dev
Browse files Browse the repository at this point in the history
feat: update version
  • Loading branch information
christyjacob4 authored Jul 7, 2021
2 parents 891392e + 290c09a commit d21f715
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

gem 'mime-types', '~> 3.1'
gem 'mime-types', '~> 3.3.1'
gemspec
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Appwrite Ruby SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-0.9.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
**This SDK is compatible with Appwrite server version 0.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/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](https://appwrite.io/docs)
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](https://appwrite.io/docs)

![Appwrite](https://appwrite.io/images/github.png)

Expand All @@ -25,7 +24,7 @@ gem install appwrite --save
## 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.
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.

```ruby
require 'appwrite'
Expand All @@ -41,7 +40,7 @@ client
```

### 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.
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](https://appwrite.io/docs) section.

```ruby
users = Appwrite::Users.new(client);
Expand Down Expand Up @@ -81,7 +80,7 @@ end
```

### Learn more
You can use followng resources to learn more and get help
You can use following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)
Expand Down
2 changes: 1 addition & 1 deletion appwrite.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'appwrite'
s.version = '2.2.0'
s.version = '2.3.0'
s.summary = "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API"
s.author = 'Appwrite Team'
s.homepage = 'https://appwrite.io/support'
Expand Down
15 changes: 15 additions & 0 deletions docs/examples/account/get-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'appwrite'

client = Appwrite::Client.new()

client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
;

account = Appwrite::Account.new(client);

response = account.get_session(session_id: '[SESSION_ID]');

puts response
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ client

functions = Appwrite::Functions.new(client);

response = functions.create(name: '[NAME]', execute: [], env: 'dotnet-3.1');
response = functions.create(name: '[NAME]', execute: [], runtime: 'java-11.0');

puts response
15 changes: 15 additions & 0 deletions docs/examples/users/update-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'appwrite'

client = Appwrite::Client.new()

client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
;

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

response = users.update_verification(user_id: '[USER_ID]', email_verification: false);

puts response
4 changes: 2 additions & 2 deletions lib/appwrite/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def initialize()
@headers = {
'content-type' => '',
'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
'x-sdk-version' => 'appwrite:ruby:2.2.0',
'X-Appwrite-Response-Format' => '0.8.0'
'x-sdk-version' => 'appwrite:ruby:2.3.0',
'X-Appwrite-Response-Format' => '0.9.0'
}
@endpoint = 'https://appwrite.io/v1';
end
Expand Down
15 changes: 15 additions & 0 deletions lib/appwrite/services/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,21 @@ def delete_sessions()
}, params);
end

def get_session(session_id:)
if session_id.nil?
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
end

path = '/account/sessions/{sessionId}'
.gsub('{sessionId}', session_id)

params = {}

return @client.call('get', path, {
'content-type' => 'application/json',
}, params);
end

def delete_session(session_id:)
if session_id.nil?
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
Expand Down
10 changes: 5 additions & 5 deletions lib/appwrite/services/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def list(search: nil, limit: nil, offset: nil, order_type: nil)
}, params);
end

def create(name:, execute:, env:, vars: nil, events: nil, schedule: nil, timeout: nil)
def create(name:, execute:, runtime:, vars: nil, events: nil, schedule: nil, timeout: nil)
if name.nil?
raise Appwrite::Exception.new('Missing required parameter: "name"')
end
Expand All @@ -36,8 +36,8 @@ def create(name:, execute:, env:, vars: nil, events: nil, schedule: nil, timeout
raise Appwrite::Exception.new('Missing required parameter: "execute"')
end

if env.nil?
raise Appwrite::Exception.new('Missing required parameter: "env"')
if runtime.nil?
raise Appwrite::Exception.new('Missing required parameter: "runtime"')
end

path = '/functions'
Expand All @@ -52,8 +52,8 @@ def create(name:, execute:, env:, vars: nil, events: nil, schedule: nil, timeout
params[:execute] = execute
end

if !env.nil?
params[:env] = env
if !runtime.nil?
params[:runtime] = runtime
end

if !vars.nil?
Expand Down
6 changes: 5 additions & 1 deletion lib/appwrite/services/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_file_download(file_id:)
}, params);
end

def get_file_preview(file_id:, width: nil, height: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
def get_file_preview(file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
if file_id.nil?
raise Appwrite::Exception.new('Missing required parameter: "fileId"')
end
Expand All @@ -147,6 +147,10 @@ def get_file_preview(file_id:, width: nil, height: nil, quality: nil, border_wid
params[:height] = height
end

if !gravity.nil?
params[:gravity] = gravity
end

if !quality.nil?
params[:quality] = quality
end
Expand Down
23 changes: 23 additions & 0 deletions lib/appwrite/services/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ def update_status(user_id:, status:)
}, params);
end

def update_verification(user_id:, email_verification:)
if user_id.nil?
raise Appwrite::Exception.new('Missing required parameter: "userId"')
end

if email_verification.nil?
raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
end

path = '/users/{userId}/verification'
.gsub('{userId}', user_id)

params = {}

if !email_verification.nil?
params[:emailVerification] = email_verification
end

return @client.call('patch', path, {
'content-type' => 'application/json',
}, params);
end


protected

Expand Down

0 comments on commit d21f715

Please sign in to comment.