Skip to content

Commit 1406f00

Browse files
authored
Merge pull request #16 from appwrite/dev
fix: patch updates for appwrite 1.4.1
2 parents 794bf40 + 2efdc80 commit 1406f00

File tree

13 files changed

+732
-676
lines changed

13 files changed

+732
-676
lines changed

appwrite.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |spec|
22

33
spec.name = 'appwrite'
4-
spec.version = '9.0.0'
4+
spec.version = '9.0.1'
55
spec.license = 'BSD-3-Clause'
66
spec.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'
77
spec.author = 'Appwrite Team'

lib/appwrite/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize
1515
'x-sdk-name'=> 'Ruby',
1616
'x-sdk-platform'=> 'server',
1717
'x-sdk-language'=> 'ruby',
18-
'x-sdk-version'=> '9.0.0',
18+
'x-sdk-version'=> '9.0.1',
1919
'X-Appwrite-Response-Format' => '1.4.0'
2020
}
2121
@endpoint = 'https://HOSTNAME/v1'
@@ -170,7 +170,7 @@ def chunked_upload(
170170
params: {}
171171
)
172172
chunks_uploaded = current['chunksUploaded'].to_i
173-
offset = [size, (chunks_uploaded * @chunk_size)].min
173+
offset = chunks_uploaded * @chunk_size
174174
end
175175

176176
while offset < size
@@ -187,7 +187,7 @@ def chunked_upload(
187187
mime_type: input_file.mime_type
188188
)
189189

190-
headers['content-range'] = "bytes #{offset}-#{[offset + @chunk_size - 1, size].min}/#{size}"
190+
headers['content-range'] = "bytes #{offset}-#{[offset + @chunk_size - 1, size - 1].min}/#{size}"
191191

192192
result = call(
193193
method: 'POST',

lib/appwrite/role.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
module Appwrite
2+
3+
# Helper class to generate role strings for `Permission`.
24
class Role
5+
6+
# Grants access to anyone.
7+
#
8+
# This includes authenticated and unauthenticated users.
9+
#
10+
# @return [String]
311
def self.any
412
'any'
513
end
614

15+
# Grants access to a specific user by user ID.
16+
#
17+
# You can optionally pass verified or unverified for
18+
# `status` to target specific types of users.
19+
#
20+
# @param [String] id
21+
# @param [String] status
22+
#
23+
# @return [String]
724
def self.user(id, status = "")
825
if(status.empty?)
926
"user:#{id}"
@@ -12,6 +29,14 @@ def self.user(id, status = "")
1229
end
1330
end
1431

32+
# Grants access to any authenticated or anonymous user.
33+
#
34+
# You can optionally pass verified or unverified for
35+
# `status` to target specific types of users.
36+
#
37+
# @param [String] status
38+
#
39+
# @return [String]
1540
def self.users(status = "")
1641
if(status.empty?)
1742
'users'
@@ -20,10 +45,24 @@ def self.users(status = "")
2045
end
2146
end
2247

48+
# Grants access to any guest user without a session.
49+
#
50+
# Authenticated users don't have access to this role.
51+
#
52+
# @return [String]
2353
def self.guests
2454
'guests'
2555
end
2656

57+
# Grants access to a team by team ID.
58+
#
59+
# You can optionally pass a role for `role` to target
60+
# team members with the specified role.
61+
#
62+
# @param [String] id
63+
# @param [String] role
64+
#
65+
# @return [String]
2766
def self.team(id, role = "")
2867
if(role.empty?)
2968
"team:#{id}"
@@ -32,8 +71,25 @@ def self.team(id, role = "")
3271
end
3372
end
3473

74+
# Grants access to a specific member of a team.
75+
#
76+
# When the member is removed from the team, they will
77+
# no longer have access.
78+
#
79+
# @param [String] id
80+
#
81+
# @return [String]
3582
def self.member(id)
3683
"member:#{id}"
3784
end
85+
86+
# Grants access to a user with the specified label.
87+
#
88+
# @param [String] name
89+
#
90+
# @return [String]
91+
def self.label(name)
92+
"label:#{name}"
93+
end
3894
end
3995
end

0 commit comments

Comments
 (0)