Skip to content

Commit

Permalink
Merge pull request #37 from appwrite/dev
Browse files Browse the repository at this point in the history
fix: pong response & chunked upload
  • Loading branch information
abnegate authored Jan 29, 2025
2 parents fdf87cd + ca74091 commit b92b436
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
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 |spec|

spec.name = 'appwrite'
spec.version = '13.1.0'
spec.version = '14.0.0'
spec.license = 'BSD-3-Clause'
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'
spec.author = 'Appwrite Team'
Expand Down
18 changes: 9 additions & 9 deletions lib/appwrite/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize
'x-sdk-name'=> 'Ruby',
'x-sdk-platform'=> 'server',
'x-sdk-language'=> 'ruby',
'x-sdk-version'=> '13.1.0',
'x-sdk-version'=> '14.0.0',
'X-Appwrite-Response-Format' => '1.6.0'
}
@endpoint = 'https://cloud.appwrite.io/v1'
Expand Down Expand Up @@ -104,7 +104,7 @@ def set_forwarded_user_agent(value)
# @return [self]
def set_endpoint(endpoint)
@endpoint = endpoint

self
end

Expand Down Expand Up @@ -187,7 +187,7 @@ def chunked_upload(

offset = 0
id_param_name = id_param_name.to_sym if id_param_name
if id_param_name&.empty? == false && params[id_param_name] != "unique()"
if id_param_name&.empty? == false
# Make a request to check if a file already exists
current = call(
method: "GET",
Expand Down Expand Up @@ -257,7 +257,7 @@ def fetch(
@http = Net::HTTP.new(uri.host, uri.port) unless defined? @http
@http.use_ssl = !@self_signed
payload = ''

headers = @headers.merge(headers)

params.compact!
Expand Down Expand Up @@ -292,7 +292,7 @@ def fetch(
if response_type == "location"
return location
end

# Handle Redirects
if (response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently)
uri = URI.parse(uri.scheme + "://" + uri.host + "" + location)
Expand Down Expand Up @@ -327,7 +327,7 @@ def fetch(

return response
end

def encode_form_data(value, key=nil)
case value
when Hash
Expand Down Expand Up @@ -359,13 +359,13 @@ def encode(value, key = nil)
when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&')
when Array then value.map { |v| encode(v, "#{key}[]") }.join('&')
when nil then ''
else
"#{key}=#{CGI.escape(value.to_s)}"
else
"#{key}=#{CGI.escape(value.to_s)}"
end
end

def append_key(root_key, key)
root_key.nil? ? key : "#{root_key}[#{key.to_s}]"
end
end
end
end
1 change: 1 addition & 0 deletions lib/appwrite/enums/image_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module ImageFormat
GIF = 'gif'
PNG = 'png'
WEBP = 'webp'
HEIC = 'heic'
AVIF = 'avif'
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/appwrite/services/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def create_mfa_challenge(factor:)
# @param [String] challenge_id ID of the challenge.
# @param [String] otp Valid verification token.
#
# @return []
# @return [Session]
def update_mfa_challenge(challenge_id:, otp:)
api_path = '/account/mfa/challenge'

Expand All @@ -431,6 +431,7 @@ def update_mfa_challenge(challenge_id:, otp:)
path: api_path,
headers: api_headers,
params: api_params,
response_type: Models::Session
)
end

Expand Down
12 changes: 10 additions & 2 deletions lib/appwrite/services/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,11 @@ def delete_deployment(function_id:, deployment_id:)
end


#
# Create a new build for an existing function deployment. This endpoint
# allows you to rebuild a deployment with the updated function configuration,
# including its entrypoint and build commands if they have been modified The
# build process will be queued and executed asynchronously. The original
# deployment's code will be preserved and used for the new build.
#
# @param [String] function_id Function ID.
# @param [String] deployment_id Deployment ID.
Expand Down Expand Up @@ -536,7 +540,11 @@ def create_build(function_id:, deployment_id:, build_id: nil)
end


#
# Cancel an ongoing function deployment build. If the build is already in
# progress, it will be stopped and marked as canceled. If the build hasn't
# started yet, it will be marked as canceled without executing. You cannot
# cancel builds that have already completed (status 'ready') or failed. The
# response includes the final build status and details.
#
# @param [String] function_id Function ID.
# @param [String] deployment_id Deployment ID.
Expand Down
2 changes: 1 addition & 1 deletion lib/appwrite/services/messaging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def create_sms(message_id:, content:, topics: nil, users: nil, targets: nil, dra
end


# Update an email message by its unique ID.
# Update an SMS message by its unique ID.
#
#
# @param [String] message_id Message ID.
Expand Down
3 changes: 1 addition & 2 deletions lib/appwrite/services/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def update_mfa(user_id:, mfa:)
# @param [String] user_id User ID.
# @param [AuthenticatorType] type Type of authenticator.
#
# @return [User]
# @return []
def delete_mfa_authenticator(user_id:, type:)
api_path = '/users/{userId}/mfa/authenticators/{type}'
.gsub('{userId}', user_id)
Expand All @@ -817,7 +817,6 @@ def delete_mfa_authenticator(user_id:, type:)
path: api_path,
headers: api_headers,
params: api_params,
response_type: Models::User
)
end

Expand Down

0 comments on commit b92b436

Please sign in to comment.