appwrite 11.0.0 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd31e4d3077b0e16537b4b69b6de4ad4544449c619d41220b2f738d0f6e4553f
4
- data.tar.gz: d2c72892a533a8a0e56418a6c8c6413907747825560256cc29b8c8fa69d03dba
3
+ metadata.gz: 0bca03eb7af675e72f241faee81443dd471831f3e7835c9f7bb32f83979a9266
4
+ data.tar.gz: 14612cd69df877ead2f82c0e0e9c9eaf423b1f059d6221570a9a285bd2f91189
5
5
  SHA512:
6
- metadata.gz: 96e0adb27cadeb348aedb9e7087269f19654fd8b6c2cf74a3c213a80c88fedbfa9bf7da3bd08d7acd0ef55bea6f8df64e3220fcd2474a46ac051a2ee69bdd7f7
7
- data.tar.gz: af720aa7bbf5d2de3c044d240c21e0ad740cd7319ca597f3791b05819018469eaef591c55ff93ce421b86c138e9908b47461d595bad15ec69bd89eec3339d09c
6
+ metadata.gz: a5afccd0969e11345fb06bf9f6857624f98a852d1359a685fe659245d490ff7a03351747b37173a9cb9030a326ee0b275c1ccee911c9cbc9509878c7c7479ac2
7
+ data.tar.gz: 8083c9e4416972961fc58af0b7a5328b72fb7e3e67f792bef5c7b8a4e04fc3600ae2e6c007e2bdf7093f4418ca34321f00b82428ed4a5514ff8096a06588a90f
@@ -15,7 +15,7 @@ module Appwrite
15
15
  'x-sdk-name'=> 'Ruby',
16
16
  'x-sdk-platform'=> 'server',
17
17
  'x-sdk-language'=> 'ruby',
18
- 'x-sdk-version'=> '11.0.0',
18
+ 'x-sdk-version'=> '11.0.1',
19
19
  'X-Appwrite-Response-Format' => '1.5.0'
20
20
  }
21
21
  @endpoint = 'https://cloud.appwrite.io/v1'
data/lib/appwrite/id.rb CHANGED
@@ -1,11 +1,27 @@
1
+ require 'securerandom'
2
+
1
3
  module Appwrite
2
4
  class ID
3
5
  def self.custom(id)
4
6
  id
5
7
  end
6
-
7
- def self.unique
8
- 'unique()'
8
+
9
+ # Generate a unique ID with padding to have a longer ID
10
+ def self.unique(padding=7)
11
+ base_id = self.hex_timestamp
12
+ random_padding = SecureRandom.hex(padding)
13
+ random_padding = random_padding[0...padding]
14
+ base_id + random_padding
15
+ end
16
+
17
+ #Generate an hex ID based on timestamp
18
+ #Recreated from https://www.php.net/manual/en/function.uniqid.php
19
+ private_class_method def self.hex_timestamp
20
+ now = Time.now
21
+ sec = now.to_i
22
+ usec = now.usec
23
+ hex_timestamp = "%08x%05x" % [sec, usec]
24
+ hex_timestamp
9
25
  end
10
26
  end
11
- end
27
+ end
@@ -789,13 +789,13 @@ module Appwrite
789
789
  #
790
790
  # @param [String] provider_id Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
791
791
  # @param [String] name Provider name.
792
- # @param [String] from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
793
- # @param [String] sender_id Msg91 Sender ID.
794
- # @param [String] auth_key Msg91 Auth Key.
792
+ # @param [String] template_id Msg91 template ID
793
+ # @param [String] sender_id Msg91 sender ID.
794
+ # @param [String] auth_key Msg91 auth key.
795
795
  # @param [] enabled Set as enabled.
796
796
  #
797
797
  # @return [Provider]
798
- def create_msg91_provider(provider_id:, name:, from: nil, sender_id: nil, auth_key: nil, enabled: nil)
798
+ def create_msg91_provider(provider_id:, name:, template_id: nil, sender_id: nil, auth_key: nil, enabled: nil)
799
799
  api_path = '/messaging/providers/msg91'
800
800
 
801
801
  if provider_id.nil?
@@ -809,7 +809,7 @@ module Appwrite
809
809
  api_params = {
810
810
  providerId: provider_id,
811
811
  name: name,
812
- from: from,
812
+ templateId: template_id,
813
813
  senderId: sender_id,
814
814
  authKey: auth_key,
815
815
  enabled: enabled,
@@ -834,12 +834,12 @@ module Appwrite
834
834
  # @param [String] provider_id Provider ID.
835
835
  # @param [String] name Provider name.
836
836
  # @param [] enabled Set as enabled.
837
- # @param [String] sender_id Msg91 Sender ID.
838
- # @param [String] auth_key Msg91 Auth Key.
839
- # @param [String] from Sender number.
837
+ # @param [String] template_id Msg91 template ID.
838
+ # @param [String] sender_id Msg91 sender ID.
839
+ # @param [String] auth_key Msg91 auth key.
840
840
  #
841
841
  # @return [Provider]
842
- def update_msg91_provider(provider_id:, name: nil, enabled: nil, sender_id: nil, auth_key: nil, from: nil)
842
+ def update_msg91_provider(provider_id:, name: nil, enabled: nil, template_id: nil, sender_id: nil, auth_key: nil)
843
843
  api_path = '/messaging/providers/msg91/{providerId}'
844
844
  .gsub('{providerId}', provider_id)
845
845
 
@@ -850,9 +850,9 @@ module Appwrite
850
850
  api_params = {
851
851
  name: name,
852
852
  enabled: enabled,
853
+ templateId: template_id,
853
854
  senderId: sender_id,
854
855
  authKey: auth_key,
855
- from: from,
856
856
  }
857
857
 
858
858
  api_headers = {
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: 11.0.0
4
+ version: 11.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-08 00:00:00.000000000 Z
11
+ date: 2024-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types