Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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-1.6.1-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.2-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?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](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 |spec|

spec.name = 'appwrite'
spec.version = '14.0.0'
spec.version = '15.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
4 changes: 2 additions & 2 deletions docs/examples/databases/update-float-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ result = databases.update_float_attribute(
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
min: null,
max: null,
default: null,
min: null, # optional
max: null, # optional
new_key: '' # optional
)
4 changes: 2 additions & 2 deletions docs/examples/databases/update-integer-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ result = databases.update_integer_attribute(
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
min: null,
max: null,
default: null,
min: null, # optional
max: null, # optional
new_key: '' # optional
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ client = Client.new

health = Health.new(client)

result = health.get_queue_usage_dump(
result = health.get_queue_stats_resources(
threshold: null # optional
)
12 changes: 0 additions & 12 deletions docs/examples/health/get-queue.md

This file was deleted.

12 changes: 8 additions & 4 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'=> '14.0.0',
'x-sdk-version'=> '15.0.0',
'X-Appwrite-Response-Format' => '1.6.0'
}
@endpoint = 'https://cloud.appwrite.io/v1'
Expand Down Expand Up @@ -103,6 +103,10 @@ def set_forwarded_user_agent(value)
#
# @return [self]
def set_endpoint(endpoint)
if not endpoint.start_with?('http://') and not endpoint.start_with?('https://')
raise Appwrite::Exception.new('Invalid endpoint URL: ' + endpoint)
end

@endpoint = endpoint

self
Expand Down Expand Up @@ -303,11 +307,11 @@ def fetch(
begin
result = JSON.parse(response.body)
rescue JSON::ParserError => e
raise Appwrite::Exception.new(response.body, response.code, nil, response)
raise Appwrite::Exception.new(response.body, response.code, nil, response.body)
end

if response.code.to_i >= 400
raise Appwrite::Exception.new(result['message'], result['status'], result['type'], result)
raise Appwrite::Exception.new(result['message'], result['status'], result['type'], response.body)
end

unless response_type.respond_to?("from")
Expand All @@ -318,7 +322,7 @@ def fetch(
end

if response.code.to_i >= 400
raise Appwrite::Exception.new(response.body, response.code, response)
raise Appwrite::Exception.new(response.body, response.code, response, response.body)
end

if response.respond_to?("body_permitted?")
Expand Down
1 change: 1 addition & 0 deletions lib/appwrite/enums/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module CreditCard
VISA = 'visa'
MIR = 'mir'
MAESTRO = 'maestro'
RUPAY = 'rupay'
end
end
end
4 changes: 2 additions & 2 deletions lib/appwrite/enums/name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Name
V1_AUDITS = 'v1-audits'
V1_MAILS = 'v1-mails'
V1_FUNCTIONS = 'v1-functions'
V1_USAGE = 'v1-usage'
V1_USAGE_DUMP = 'v1-usage-dump'
V1_STATS_RESOURCES = 'v1-stats-resources'
V1_STATS_USAGE = 'v1-stats-usage'
V1_WEBHOOKS = 'v1-webhooks'
V1_CERTIFICATES = 'v1-certificates'
V1_BUILDS = 'v1-builds'
Expand Down
1 change: 1 addition & 0 deletions lib/appwrite/enums/o_auth_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module OAuthProvider
DROPBOX = 'dropbox'
ETSY = 'etsy'
FACEBOOK = 'facebook'
FIGMA = 'figma'
GITHUB = 'github'
GITLAB = 'gitlab'
GOOGLE = 'google'
Expand Down
11 changes: 1 addition & 10 deletions lib/appwrite/services/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def get()
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -137,7 +136,6 @@ def list_identities(queries: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -221,7 +219,6 @@ def list_logs(queries: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -447,7 +444,6 @@ def list_mfa_factors()
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand All @@ -474,7 +470,6 @@ def get_mfa_recovery_codes()
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -657,7 +652,6 @@ def get_prefs()
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -808,7 +802,6 @@ def list_sessions()
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -1048,7 +1041,6 @@ def get_session(session_id:)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -1267,7 +1259,7 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil)
# about session
# limits](https://appwrite.io/docs/authentication-security#limits).
#
# @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
# @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
# @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
# @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
# @param [Array] scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
Expand All @@ -1288,7 +1280,6 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down
9 changes: 1 addition & 8 deletions lib/appwrite/services/avatars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def get_browser(code:, width: nil, height: nil, quality: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand All @@ -61,7 +60,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil)
# of image returned is 100x100px.
#
#
# @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
# @param [CreditCard] code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.
# @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
# @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
# @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
Expand All @@ -82,7 +81,6 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -114,7 +112,6 @@ def get_favicon(url:)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -158,7 +155,6 @@ def get_flag(code:, width: nil, height: nil, quality: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -201,7 +197,6 @@ def get_image(url:, width: nil, height: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -247,7 +242,6 @@ def get_initials(name: nil, width: nil, height: nil, background: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down Expand Up @@ -284,7 +278,6 @@ def get_qr(text:, size: nil, margin: nil, download: nil)
}

api_headers = {
"content-type": 'application/json',
}

@client.call(
Expand Down
Loading