appwrite 1.0.11 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3467bd38994ec4d52513f365ac2f0965c0e7d460f4bdf0889d02ee6f789a18b0
4
- data.tar.gz: d14dea1f9687bbb6ed58a361814790d076260b3d004627b0ab5a8735fde9d7c8
3
+ metadata.gz: aed117cf461a878f949d987bfc8dfabc562be72e34cfd648d0047651b4f986e7
4
+ data.tar.gz: f7dfd52f109f0566e010b2958efff2a8b201332e56de28ff51184b1721b57791
5
5
  SHA512:
6
- metadata.gz: '08a910898454ceb670cea969d74fcc4fa13eadc2fbcd2ce43deea6f9302e21f42a80ddff1c99d7542562d2058a14742307e2eeaff04b1235362b5914808f2002'
7
- data.tar.gz: 2a336f8d31273a5f94e4df3a4fc305675cb856a0cdcc5c1ad4907fb00d6316a6a9a23b20d57ab77fea2ebfa560c6b882ca6b6f36835a117631d6f4854d8b29ad
6
+ metadata.gz: df0356df74fd99bb0bc4dab701b274a9b5ec2f798148875ca147265c99a27ca44b60478492fed5e7d0192aecb07bd97399e7b7e699a50b46040f038abd58f93d
7
+ data.tar.gz: 8a9a553d9272f3ad02ecc4684b92d0fcf2e9206dd7d4daa42733d5418ddfaa11ef6c93e44d61502cde503fef8e342141afef49c88b7d56b4e6acce733bd03078
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'mime-types', '~> 3.1'
3
4
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors.
1
+ Copyright (c) 2021 Appwrite (https://appwrite.io) and individual contributors.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
data/README.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # Appwrite Ruby SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?v=1)
4
- ![Version](https://img.shields.io/badge/api%20version-0.6.1-blue.svg?v=1)
4
+ ![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1)
5
5
 
6
- **This SDK is compatible with Appwrite server version 0.6.1. For older versions, please check previous releases.**
6
+ **This SDK is compatible with Appwrite server version 0.7.0. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
7
7
 
8
8
  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.
9
9
  Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
10
10
  For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11
11
 
12
-
13
-
14
12
  ![Appwrite](https://appwrite.io/images/github.png)
15
13
 
16
14
  ## Installation
data/appwrite.gemspec CHANGED
@@ -1,13 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'appwrite'
4
- s.version = '1.0.11'
5
- s.summary = "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.
6
- Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
7
- For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)"
4
+ s.version = '2.0.0'
5
+ 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"
8
6
  s.author = 'Appwrite Team'
9
7
  s.homepage = 'https://appwrite.io/support'
10
- s.email = 'team@localhost.test'
8
+ s.email = 'team@appwrite.io'
11
9
  s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
12
10
 
13
11
  end
@@ -8,8 +8,8 @@ client
8
8
  .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
9
  ;
10
10
 
11
- database = Appwrite::Database.new(client);
11
+ avatars = Appwrite::Avatars.new(client);
12
12
 
13
- response = database.get_collection_logs(collection_id: '[COLLECTION_ID]');
13
+ response = avatars.get_initials();
14
14
 
15
15
  puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.create_execution(function_id: '[FUNCTION_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.create_tag(function_id: '[FUNCTION_ID]', command: '[COMMAND]', code: Appwrite::File.new());
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.create(name: '[NAME]', execute: [], env: 'node-14.5');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.delete_tag(function_id: '[FUNCTION_ID]', tag_id: '[TAG_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.delete(function_id: '[FUNCTION_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.get_execution(function_id: '[FUNCTION_ID]', execution_id: '[EXECUTION_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.get_tag(function_id: '[FUNCTION_ID]', tag_id: '[TAG_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.get(function_id: '[FUNCTION_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.list_executions(function_id: '[FUNCTION_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.list_tags(function_id: '[FUNCTION_ID]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.list();
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.update_tag(function_id: '[FUNCTION_ID]', tag: '[TAG]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ functions = Appwrite::Functions.new(client);
12
+
13
+ response = functions.update(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: []);
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ locale = Appwrite::Locale.new(client);
12
+
13
+ response = locale.get_languages();
14
+
15
+ puts response
@@ -10,6 +10,6 @@ client
10
10
 
11
11
  storage = Appwrite::Storage.new(client);
12
12
 
13
- response = storage.create_file(file: File.new(), read: [], write: []);
13
+ response = storage.create_file(file: Appwrite::File.new(), read: [], write: []);
14
14
 
15
15
  puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ users = Appwrite::Users.new(client);
12
+
13
+ response = users.delete_user(user_id: '[USER_ID]');
14
+
15
+ puts response
data/lib/appwrite.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  require 'net/http'
2
2
  require 'uri'
3
3
  require 'json'
4
+ require 'mime/types'
4
5
  require_relative 'appwrite/client'
5
6
  require_relative 'appwrite/service'
7
+ require_relative 'appwrite/file'
6
8
  require_relative 'appwrite/services/avatars'
7
9
  require_relative 'appwrite/services/database'
10
+ require_relative 'appwrite/services/functions'
8
11
  require_relative 'appwrite/services/health'
9
12
  require_relative 'appwrite/services/locale'
10
13
  require_relative 'appwrite/services/storage'
@@ -20,7 +20,8 @@ module Appwrite
20
20
  @headers = {
21
21
  'content-type' => '',
22
22
  'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
23
- 'x-sdk-version' => 'appwrite:ruby:1.0.11'
23
+ 'x-sdk-version' => 'appwrite:ruby:2.0.0'
24
+
24
25
  }
25
26
  @endpoint = 'https://appwrite.io/v1';
26
27
  end
@@ -72,11 +73,14 @@ module Appwrite
72
73
  payload = ''
73
74
 
74
75
  headers = @headers.merge(headers)
75
-
76
+ @BOUNDARY = "----A30#3ad1"
76
77
  if (method != METHOD_GET)
77
78
  case headers['content-type'][0, headers['content-type'].index(';') || headers['content-type'].length]
78
79
  when 'application/json'
79
80
  payload = params.to_json
81
+ when 'multipart/form-data'
82
+ payload = "--#{@BOUNDARY}\r\n" + encodeFormData(params)
83
+ headers['content-type'] = "multipart/form-data; boundary=#{@BOUNDARY}"
80
84
  else
81
85
  payload = encode(params)
82
86
  end
@@ -98,6 +102,27 @@ module Appwrite
98
102
 
99
103
  return JSON.parse(response.body);
100
104
  end
105
+
106
+ def encodeFormData(value, key=nil)
107
+ case value
108
+ when Hash then value.map { |k,v| encodeFormData(v,k) }.join
109
+ when Array then value.map { |v| encodeFormData(v, "#{key}[]") }.join
110
+ when nil then ''
111
+ else
112
+ post_body = []
113
+ if(value.instance_of? File)
114
+ post_body << "Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{value.name}\"\r\n"
115
+ post_body << "Content-Type: #{value.mimeType}\r\n\r\n"
116
+ post_body << value.content
117
+ post_body << "\r\n--#{@BOUNDARY}--\r\n"
118
+ else
119
+ post_body << "Content-Disposition: form-data; name=\"#{key}\"\r\n\r\n"
120
+ post_body << "#{value.to_s}"
121
+ post_body << "\r\n--#{@BOUNDARY}\r\n"
122
+ end
123
+ post_body.join
124
+ end
125
+ end
101
126
 
102
127
  def encode(value, key = nil)
103
128
  case value
@@ -0,0 +1,23 @@
1
+ require 'mime/types'
2
+
3
+ module Appwrite
4
+ class File
5
+ def initialize(path)
6
+ @name = ::File.basename(path)
7
+ @content = ::File.read(path)
8
+ @mimeType = MIME::Types.type_for(path)
9
+ end
10
+
11
+ def name
12
+ @name
13
+ end
14
+
15
+ def content
16
+ @content
17
+ end
18
+
19
+ def mimeType
20
+ @mimeType
21
+ end
22
+ end
23
+ end
@@ -72,7 +72,23 @@ module Appwrite
72
72
  }, params);
73
73
  end
74
74
 
75
- def get_q_r(text:, size: 400, margin: 1, download: 0)
75
+ def get_initials(name: '', width: 500, height: 500, color: '', background: '')
76
+ path = '/avatars/initials'
77
+
78
+ params = {
79
+ 'name': name,
80
+ 'width': width,
81
+ 'height': height,
82
+ 'color': color,
83
+ 'background': background
84
+ }
85
+
86
+ return @client.call('get', path, {
87
+ 'content-type' => 'application/json',
88
+ }, params);
89
+ end
90
+
91
+ def get_q_r(text:, size: 400, margin: 1, download: false)
76
92
  path = '/avatars/qr'
77
93
 
78
94
  params = {
@@ -71,20 +71,18 @@ module Appwrite
71
71
  }, params);
72
72
  end
73
73
 
74
- def list_documents(collection_id:, filters: [], offset: 0, limit: 50, order_field: '$id', order_type: 'ASC', order_cast: 'string', search: '', first: 0, last: 0)
74
+ def list_documents(collection_id:, filters: [], limit: 25, offset: 0, order_field: '', order_type: 'ASC', order_cast: 'string', search: '')
75
75
  path = '/database/collections/{collectionId}/documents'
76
76
  .gsub('{collectionId}', collection_id)
77
77
 
78
78
  params = {
79
79
  'filters': filters,
80
- 'offset': offset,
81
80
  'limit': limit,
81
+ 'offset': offset,
82
82
  'orderField': order_field,
83
83
  'orderType': order_type,
84
84
  'orderCast': order_cast,
85
- 'search': search,
86
- 'first': first,
87
- 'last': last
85
+ 'search': search
88
86
  }
89
87
 
90
88
  return @client.call('get', path, {
@@ -152,18 +150,6 @@ module Appwrite
152
150
  }, params);
153
151
  end
154
152
 
155
- def get_collection_logs(collection_id:)
156
- path = '/database/collections/{collectionId}/logs'
157
- .gsub('{collectionId}', collection_id)
158
-
159
- params = {
160
- }
161
-
162
- return @client.call('get', path, {
163
- 'content-type' => 'application/json',
164
- }, params);
165
- end
166
-
167
153
 
168
154
  protected
169
155
 
@@ -0,0 +1,194 @@
1
+ module Appwrite
2
+ class Functions < Service
3
+
4
+ def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
5
+ path = '/functions'
6
+
7
+ params = {
8
+ 'search': search,
9
+ 'limit': limit,
10
+ 'offset': offset,
11
+ 'orderType': order_type
12
+ }
13
+
14
+ return @client.call('get', path, {
15
+ 'content-type' => 'application/json',
16
+ }, params);
17
+ end
18
+
19
+ def create(name:, execute:, env:, vars: {}, events: [], schedule: '', timeout: 15)
20
+ path = '/functions'
21
+
22
+ params = {
23
+ 'name': name,
24
+ 'execute': execute,
25
+ 'env': env,
26
+ 'vars': vars,
27
+ 'events': events,
28
+ 'schedule': schedule,
29
+ 'timeout': timeout
30
+ }
31
+
32
+ return @client.call('post', path, {
33
+ 'content-type' => 'application/json',
34
+ }, params);
35
+ end
36
+
37
+ def get(function_id:)
38
+ path = '/functions/{functionId}'
39
+ .gsub('{functionId}', function_id)
40
+
41
+ params = {
42
+ }
43
+
44
+ return @client.call('get', path, {
45
+ 'content-type' => 'application/json',
46
+ }, params);
47
+ end
48
+
49
+ def update(function_id:, name:, execute:, vars: {}, events: [], schedule: '', timeout: 15)
50
+ path = '/functions/{functionId}'
51
+ .gsub('{functionId}', function_id)
52
+
53
+ params = {
54
+ 'name': name,
55
+ 'execute': execute,
56
+ 'vars': vars,
57
+ 'events': events,
58
+ 'schedule': schedule,
59
+ 'timeout': timeout
60
+ }
61
+
62
+ return @client.call('put', path, {
63
+ 'content-type' => 'application/json',
64
+ }, params);
65
+ end
66
+
67
+ def delete(function_id:)
68
+ path = '/functions/{functionId}'
69
+ .gsub('{functionId}', function_id)
70
+
71
+ params = {
72
+ }
73
+
74
+ return @client.call('delete', path, {
75
+ 'content-type' => 'application/json',
76
+ }, params);
77
+ end
78
+
79
+ def list_executions(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
80
+ path = '/functions/{functionId}/executions'
81
+ .gsub('{functionId}', function_id)
82
+
83
+ params = {
84
+ 'search': search,
85
+ 'limit': limit,
86
+ 'offset': offset,
87
+ 'orderType': order_type
88
+ }
89
+
90
+ return @client.call('get', path, {
91
+ 'content-type' => 'application/json',
92
+ }, params);
93
+ end
94
+
95
+ def create_execution(function_id:)
96
+ path = '/functions/{functionId}/executions'
97
+ .gsub('{functionId}', function_id)
98
+
99
+ params = {
100
+ }
101
+
102
+ return @client.call('post', path, {
103
+ 'content-type' => 'application/json',
104
+ }, params);
105
+ end
106
+
107
+ def get_execution(function_id:, execution_id:)
108
+ path = '/functions/{functionId}/executions/{executionId}'
109
+ .gsub('{functionId}', function_id)
110
+ .gsub('{executionId}', execution_id)
111
+
112
+ params = {
113
+ }
114
+
115
+ return @client.call('get', path, {
116
+ 'content-type' => 'application/json',
117
+ }, params);
118
+ end
119
+
120
+ def update_tag(function_id:, tag:)
121
+ path = '/functions/{functionId}/tag'
122
+ .gsub('{functionId}', function_id)
123
+
124
+ params = {
125
+ 'tag': tag
126
+ }
127
+
128
+ return @client.call('patch', path, {
129
+ 'content-type' => 'application/json',
130
+ }, params);
131
+ end
132
+
133
+ def list_tags(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
134
+ path = '/functions/{functionId}/tags'
135
+ .gsub('{functionId}', function_id)
136
+
137
+ params = {
138
+ 'search': search,
139
+ 'limit': limit,
140
+ 'offset': offset,
141
+ 'orderType': order_type
142
+ }
143
+
144
+ return @client.call('get', path, {
145
+ 'content-type' => 'application/json',
146
+ }, params);
147
+ end
148
+
149
+ def create_tag(function_id:, command:, code:)
150
+ path = '/functions/{functionId}/tags'
151
+ .gsub('{functionId}', function_id)
152
+
153
+ params = {
154
+ 'command': command,
155
+ 'code': code
156
+ }
157
+
158
+ return @client.call('post', path, {
159
+ 'content-type' => 'multipart/form-data',
160
+ }, params);
161
+ end
162
+
163
+ def get_tag(function_id:, tag_id:)
164
+ path = '/functions/{functionId}/tags/{tagId}'
165
+ .gsub('{functionId}', function_id)
166
+ .gsub('{tagId}', tag_id)
167
+
168
+ params = {
169
+ }
170
+
171
+ return @client.call('get', path, {
172
+ 'content-type' => 'application/json',
173
+ }, params);
174
+ end
175
+
176
+ def delete_tag(function_id:, tag_id:)
177
+ path = '/functions/{functionId}/tags/{tagId}'
178
+ .gsub('{functionId}', function_id)
179
+ .gsub('{tagId}', tag_id)
180
+
181
+ params = {
182
+ }
183
+
184
+ return @client.call('delete', path, {
185
+ 'content-type' => 'application/json',
186
+ }, params);
187
+ end
188
+
189
+
190
+ protected
191
+
192
+ private
193
+ end
194
+ end
@@ -67,6 +67,17 @@ module Appwrite
67
67
  }, params);
68
68
  end
69
69
 
70
+ def get_languages()
71
+ path = '/locale/languages'
72
+
73
+ params = {
74
+ }
75
+
76
+ return @client.call('get', path, {
77
+ 'content-type' => 'application/json',
78
+ }, params);
79
+ end
80
+
70
81
 
71
82
  protected
72
83
 
@@ -97,12 +97,11 @@ module Appwrite
97
97
  }, params);
98
98
  end
99
99
 
100
- def get_file_view(file_id:, as: '')
100
+ def get_file_view(file_id:)
101
101
  path = '/storage/files/{fileId}/view'
102
102
  .gsub('{fileId}', file_id)
103
103
 
104
104
  params = {
105
- 'as': as
106
105
  }
107
106
 
108
107
  return @client.call('get', path, {
@@ -66,11 +66,15 @@ module Appwrite
66
66
  }, params);
67
67
  end
68
68
 
69
- def get_memberships(team_id:)
69
+ def get_memberships(team_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
70
70
  path = '/teams/{teamId}/memberships'
71
71
  .gsub('{teamId}', team_id)
72
72
 
73
73
  params = {
74
+ 'search': search,
75
+ 'limit': limit,
76
+ 'offset': offset,
77
+ 'orderType': order_type
74
78
  }
75
79
 
76
80
  return @client.call('get', path, {
@@ -42,6 +42,18 @@ module Appwrite
42
42
  }, params);
43
43
  end
44
44
 
45
+ def delete_user(user_id:)
46
+ path = '/users/{userId}'
47
+ .gsub('{userId}', user_id)
48
+
49
+ params = {
50
+ }
51
+
52
+ return @client.call('delete', path, {
53
+ 'content-type' => 'application/json',
54
+ }, params);
55
+ end
56
+
45
57
  def get_logs(user_id:)
46
58
  path = '/users/{userId}/logs'
47
59
  .gsub('{userId}', user_id)
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-30 00:00:00.000000000 Z
11
+ date: 2021-02-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
- email: team@localhost.test
14
+ email: team@appwrite.io
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
@@ -26,18 +26,31 @@ files:
26
26
  - docs/examples/avatars/get-favicon.md
27
27
  - docs/examples/avatars/get-flag.md
28
28
  - docs/examples/avatars/get-image.md
29
+ - docs/examples/avatars/get-initials.md
29
30
  - docs/examples/avatars/get-q-r.md
30
31
  - docs/examples/database/create-collection.md
31
32
  - docs/examples/database/create-document.md
32
33
  - docs/examples/database/delete-collection.md
33
34
  - docs/examples/database/delete-document.md
34
- - docs/examples/database/get-collection-logs.md
35
35
  - docs/examples/database/get-collection.md
36
36
  - docs/examples/database/get-document.md
37
37
  - docs/examples/database/list-collections.md
38
38
  - docs/examples/database/list-documents.md
39
39
  - docs/examples/database/update-collection.md
40
40
  - docs/examples/database/update-document.md
41
+ - docs/examples/functions/create-execution.md
42
+ - docs/examples/functions/create-tag.md
43
+ - docs/examples/functions/create.md
44
+ - docs/examples/functions/delete-tag.md
45
+ - docs/examples/functions/delete.md
46
+ - docs/examples/functions/get-execution.md
47
+ - docs/examples/functions/get-tag.md
48
+ - docs/examples/functions/get.md
49
+ - docs/examples/functions/list-executions.md
50
+ - docs/examples/functions/list-tags.md
51
+ - docs/examples/functions/list.md
52
+ - docs/examples/functions/update-tag.md
53
+ - docs/examples/functions/update.md
41
54
  - docs/examples/health/get-anti-virus.md
42
55
  - docs/examples/health/get-cache.md
43
56
  - docs/examples/health/get-d-b.md
@@ -55,6 +68,7 @@ files:
55
68
  - docs/examples/locale/get-countries-phones.md
56
69
  - docs/examples/locale/get-countries.md
57
70
  - docs/examples/locale/get-currencies.md
71
+ - docs/examples/locale/get-languages.md
58
72
  - docs/examples/locale/get.md
59
73
  - docs/examples/storage/create-file.md
60
74
  - docs/examples/storage/delete-file.md
@@ -75,6 +89,7 @@ files:
75
89
  - docs/examples/users/create.md
76
90
  - docs/examples/users/delete-session.md
77
91
  - docs/examples/users/delete-sessions.md
92
+ - docs/examples/users/delete-user.md
78
93
  - docs/examples/users/get-logs.md
79
94
  - docs/examples/users/get-prefs.md
80
95
  - docs/examples/users/get-sessions.md
@@ -84,9 +99,11 @@ files:
84
99
  - docs/examples/users/update-status.md
85
100
  - lib/appwrite.rb
86
101
  - lib/appwrite/client.rb
102
+ - lib/appwrite/file.rb
87
103
  - lib/appwrite/service.rb
88
104
  - lib/appwrite/services/avatars.rb
89
105
  - lib/appwrite/services/database.rb
106
+ - lib/appwrite/services/functions.rb
90
107
  - lib/appwrite/services/health.rb
91
108
  - lib/appwrite/services/locale.rb
92
109
  - lib/appwrite/services/storage.rb
@@ -113,10 +130,6 @@ requirements: []
113
130
  rubygems_version: 3.0.3
114
131
  signing_key:
115
132
  specification_version: 4
116
- summary: Appwrite is an open-source backend as a service server that abstract and
117
- simplify complex and repetitive development tasks behind a very simple to use REST
118
- API. Appwrite aims to help you develop your apps faster and in a more secure way.
119
- Use the Ruby SDK to integrate your app with the Appwrite server to easily start
120
- interacting with all of Appwrite backend APIs and tools. For full API documentation
121
- and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
133
+ summary: Appwrite is an open-source self-hosted backend server that abstract and simplify
134
+ complex and repetitive development tasks behind a very simple REST API
122
135
  test_files: []