Skip to content

Commit 55354be

Browse files
Merge pull request #38 from appwrite/dev
fix: remove content-type from GET requests
2 parents b92b436 + 9f10a97 commit 55354be

20 files changed

+42
-185
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite Ruby SDK
22

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

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 = '14.0.0'
4+
spec.version = '15.0.0'
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'

docs/examples/databases/update-float-attribute.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ result = databases.update_float_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
min: null,
18-
max: null,
1917
default: null,
18+
min: null, # optional
19+
max: null, # optional
2020
new_key: '' # optional
2121
)

docs/examples/databases/update-integer-attribute.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ result = databases.update_integer_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
min: null,
18-
max: null,
1917
default: null,
18+
min: null, # optional
19+
max: null, # optional
2020
new_key: '' # optional
2121
)

docs/examples/health/get-queue-usage-dump.md renamed to docs/examples/health/get-queue-stats-resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ client = Client.new
99

1010
health = Health.new(client)
1111

12-
result = health.get_queue_usage_dump(
12+
result = health.get_queue_stats_resources(
1313
threshold: null # optional
1414
)

docs/examples/health/get-queue.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

lib/appwrite/client.rb

Lines changed: 8 additions & 4 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'=> '14.0.0',
18+
'x-sdk-version'=> '15.0.0',
1919
'X-Appwrite-Response-Format' => '1.6.0'
2020
}
2121
@endpoint = 'https://cloud.appwrite.io/v1'
@@ -103,6 +103,10 @@ def set_forwarded_user_agent(value)
103103
#
104104
# @return [self]
105105
def set_endpoint(endpoint)
106+
if not endpoint.start_with?('http://') and not endpoint.start_with?('https://')
107+
raise Appwrite::Exception.new('Invalid endpoint URL: ' + endpoint)
108+
end
109+
106110
@endpoint = endpoint
107111

108112
self
@@ -303,11 +307,11 @@ def fetch(
303307
begin
304308
result = JSON.parse(response.body)
305309
rescue JSON::ParserError => e
306-
raise Appwrite::Exception.new(response.body, response.code, nil, response)
310+
raise Appwrite::Exception.new(response.body, response.code, nil, response.body)
307311
end
308312

309313
if response.code.to_i >= 400
310-
raise Appwrite::Exception.new(result['message'], result['status'], result['type'], result)
314+
raise Appwrite::Exception.new(result['message'], result['status'], result['type'], response.body)
311315
end
312316

313317
unless response_type.respond_to?("from")
@@ -318,7 +322,7 @@ def fetch(
318322
end
319323

320324
if response.code.to_i >= 400
321-
raise Appwrite::Exception.new(response.body, response.code, response)
325+
raise Appwrite::Exception.new(response.body, response.code, response, response.body)
322326
end
323327

324328
if response.respond_to?("body_permitted?")

lib/appwrite/enums/credit_card.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module CreditCard
1717
VISA = 'visa'
1818
MIR = 'mir'
1919
MAESTRO = 'maestro'
20+
RUPAY = 'rupay'
2021
end
2122
end
2223
end

lib/appwrite/enums/name.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module Name
66
V1_AUDITS = 'v1-audits'
77
V1_MAILS = 'v1-mails'
88
V1_FUNCTIONS = 'v1-functions'
9-
V1_USAGE = 'v1-usage'
10-
V1_USAGE_DUMP = 'v1-usage-dump'
9+
V1_STATS_RESOURCES = 'v1-stats-resources'
10+
V1_STATS_USAGE = 'v1-stats-usage'
1111
V1_WEBHOOKS = 'v1-webhooks'
1212
V1_CERTIFICATES = 'v1-certificates'
1313
V1_BUILDS = 'v1-builds'

lib/appwrite/enums/o_auth_provider.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module OAuthProvider
1515
DROPBOX = 'dropbox'
1616
ETSY = 'etsy'
1717
FACEBOOK = 'facebook'
18+
FIGMA = 'figma'
1819
GITHUB = 'github'
1920
GITLAB = 'gitlab'
2021
GOOGLE = 'google'

lib/appwrite/services/account.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def get()
1818
}
1919

2020
api_headers = {
21-
"content-type": 'application/json',
2221
}
2322

2423
@client.call(
@@ -137,7 +136,6 @@ def list_identities(queries: nil)
137136
}
138137

139138
api_headers = {
140-
"content-type": 'application/json',
141139
}
142140

143141
@client.call(
@@ -221,7 +219,6 @@ def list_logs(queries: nil)
221219
}
222220

223221
api_headers = {
224-
"content-type": 'application/json',
225222
}
226223

227224
@client.call(
@@ -447,7 +444,6 @@ def list_mfa_factors()
447444
}
448445

449446
api_headers = {
450-
"content-type": 'application/json',
451447
}
452448

453449
@client.call(
@@ -474,7 +470,6 @@ def get_mfa_recovery_codes()
474470
}
475471

476472
api_headers = {
477-
"content-type": 'application/json',
478473
}
479474

480475
@client.call(
@@ -657,7 +652,6 @@ def get_prefs()
657652
}
658653

659654
api_headers = {
660-
"content-type": 'application/json',
661655
}
662656

663657
@client.call(
@@ -808,7 +802,6 @@ def list_sessions()
808802
}
809803

810804
api_headers = {
811-
"content-type": 'application/json',
812805
}
813806

814807
@client.call(
@@ -1048,7 +1041,6 @@ def get_session(session_id:)
10481041
}
10491042

10501043
api_headers = {
1051-
"content-type": 'application/json',
10521044
}
10531045

10541046
@client.call(
@@ -1267,7 +1259,7 @@ def create_magic_url_token(user_id:, email:, url: nil, phrase: nil)
12671259
# about session
12681260
# limits](https://appwrite.io/docs/authentication-security#limits).
12691261
#
1270-
# @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.
1262+
# @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.
12711263
# @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.
12721264
# @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.
12731265
# @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.
@@ -1288,7 +1280,6 @@ def create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil)
12881280
}
12891281

12901282
api_headers = {
1291-
"content-type": 'application/json',
12921283
}
12931284

12941285
@client.call(

lib/appwrite/services/avatars.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def get_browser(code:, width: nil, height: nil, quality: nil)
3939
}
4040

4141
api_headers = {
42-
"content-type": 'application/json',
4342
}
4443

4544
@client.call(
@@ -61,7 +60,7 @@ def get_browser(code:, width: nil, height: nil, quality: nil)
6160
# of image returned is 100x100px.
6261
#
6362
#
64-
# @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.
63+
# @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.
6564
# @param [Integer] width Image width. Pass an integer between 0 to 2000. Defaults to 100.
6665
# @param [Integer] height Image height. Pass an integer between 0 to 2000. Defaults to 100.
6766
# @param [Integer] quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
@@ -82,7 +81,6 @@ def get_credit_card(code:, width: nil, height: nil, quality: nil)
8281
}
8382

8483
api_headers = {
85-
"content-type": 'application/json',
8684
}
8785

8886
@client.call(
@@ -114,7 +112,6 @@ def get_favicon(url:)
114112
}
115113

116114
api_headers = {
117-
"content-type": 'application/json',
118115
}
119116

120117
@client.call(
@@ -158,7 +155,6 @@ def get_flag(code:, width: nil, height: nil, quality: nil)
158155
}
159156

160157
api_headers = {
161-
"content-type": 'application/json',
162158
}
163159

164160
@client.call(
@@ -201,7 +197,6 @@ def get_image(url:, width: nil, height: nil)
201197
}
202198

203199
api_headers = {
204-
"content-type": 'application/json',
205200
}
206201

207202
@client.call(
@@ -247,7 +242,6 @@ def get_initials(name: nil, width: nil, height: nil, background: nil)
247242
}
248243

249244
api_headers = {
250-
"content-type": 'application/json',
251245
}
252246

253247
@client.call(
@@ -284,7 +278,6 @@ def get_qr(text:, size: nil, margin: nil, download: nil)
284278
}
285279

286280
api_headers = {
287-
"content-type": 'application/json',
288281
}
289282

290283
@client.call(

0 commit comments

Comments
 (0)