appwrite 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08e68904b5658a70b0d6ec2824ad112522deb02b41bc16f2f4c1dd687480c58f'
4
- data.tar.gz: c242643369feb6e65e78c95d31fe6d396f8476353544f6e3eb321eebaa865ad3
3
+ metadata.gz: e0a43892e76af8c4735fccaafc05ad81928c7edce92ee6b65ba4a1794acedec4
4
+ data.tar.gz: f3374f9e75911a346d0a95380075cf623b4cec41a3cba4c916dfec106c245213
5
5
  SHA512:
6
- metadata.gz: 0c616cf3ca5980cb81723a07d9dabfacf3060262984a181cb13ae1b30abfe6367775a6a59bd1a3ee78c8fa9f609f6c6690bf9d9cce2b382b5aac8a3ec654a07e
7
- data.tar.gz: e63834b15e6cdeb33d7279c3710d0bf47f3d33ad6fd2a475adf63d9dcb6c9b794e42a936ae66046f1ca1a6e9c855bbb1831c6523c0e60719e599c83a400348d2
6
+ metadata.gz: 146ec7c6467b2da51f74c05a2c94130713a6927005751fdf0668d2e978880f6b1bec9641a9b6abac5f611e4f8ec1fe7d0530b4d6bd9809986275302299db52ef
7
+ data.tar.gz: b52ba081c05fed4b64982caf1c5df29e37bcc5d3e036756d4c2c061381d21e30ac2513745ea0477c279336067c456bcc6dd8bc8189222b2be3e0d71a0b5c23b4
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'appwrite'
4
- s.version = '1.0.3'
4
+ s.version = '1.0.4'
5
5
  s.summary = "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)"
6
6
  s.author = 'Appwrite Team'
7
7
  s.homepage = 'https://appwrite.io/support'
@@ -1,6 +1,7 @@
1
1
  require 'net/http'
2
2
  require 'uri'
3
3
  require 'json'
4
+ require 'cgi'
4
5
 
5
6
  module Appwrite
6
7
  class Client
@@ -19,7 +20,7 @@ module Appwrite
19
20
  @headers = {
20
21
  'content-type' => '',
21
22
  'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
22
- 'x-sdk-version' => 'appwrite:ruby:1.0.3'
23
+ 'x-sdk-version' => 'appwrite:ruby:1.0.4'
23
24
  }
24
25
  @endpoint = 'https://appwrite.io/v1';
25
26
  end
@@ -61,7 +62,7 @@ module Appwrite
61
62
  end
62
63
 
63
64
  def call(method, path = '', headers = {}, params = {})
64
- uri = URI.parse(@endpoint + path + ((method == METHOD_GET) ? '?' + URI.encode_www_form(params) : ''))
65
+ uri = URI.parse(@endpoint + path + ((method == METHOD_GET) ? '?' + encode(params) : ''))
65
66
  http = Net::HTTP.new(uri.host, uri.port)
66
67
  http.use_ssl = (uri.scheme == 'https')
67
68
  payload = ''
@@ -73,7 +74,7 @@ module Appwrite
73
74
  when 'application/json'
74
75
  payload = params.to_json
75
76
  else
76
- payload = URI.encode_www_form(params)
77
+ payload = encode(params)
77
78
  end
78
79
  end
79
80
 
@@ -89,5 +90,19 @@ module Appwrite
89
90
  protected
90
91
 
91
92
  private
93
+
94
+ def encode(value, key = nil)
95
+ case value
96
+ when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&')
97
+ when Array then value.map { |v| encode(v, "#{key}[]") }.join('&')
98
+ when nil then ''
99
+ else
100
+ "#{key}=#{CGI.escape(value.to_s)}"
101
+ end
102
+ end
103
+
104
+ def append_key(root_key, key)
105
+ root_key.nil? ? key : "#{root_key}[#{key.to_s}]"
106
+ end
92
107
  end
93
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: team@appwrite.io