appwrite 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +134 -57
  3. data/lib/appwrite/exception.rb +5 -7
  4. data/lib/appwrite/file.rb +5 -13
  5. data/lib/appwrite/models/attribute_boolean.rb +52 -0
  6. data/lib/appwrite/models/attribute_email.rb +57 -0
  7. data/lib/appwrite/models/attribute_enum.rb +62 -0
  8. data/lib/appwrite/models/attribute_float.rb +62 -0
  9. data/lib/appwrite/models/attribute_integer.rb +62 -0
  10. data/lib/appwrite/models/attribute_ip.rb +57 -0
  11. data/lib/appwrite/models/attribute_list.rb +32 -0
  12. data/lib/appwrite/models/attribute_string.rb +57 -0
  13. data/lib/appwrite/models/attribute_url.rb +57 -0
  14. data/lib/appwrite/models/collection.rb +62 -0
  15. data/lib/appwrite/models/collection_list.rb +32 -0
  16. data/lib/appwrite/models/continent.rb +32 -0
  17. data/lib/appwrite/models/continent_list.rb +32 -0
  18. data/lib/appwrite/models/country.rb +32 -0
  19. data/lib/appwrite/models/country_list.rb +32 -0
  20. data/lib/appwrite/models/currency.rb +57 -0
  21. data/lib/appwrite/models/currency_list.rb +32 -0
  22. data/lib/appwrite/models/document.rb +50 -0
  23. data/lib/appwrite/models/document_list.rb +36 -0
  24. data/lib/appwrite/models/execution.rb +72 -0
  25. data/lib/appwrite/models/execution_list.rb +32 -0
  26. data/lib/appwrite/models/file.rb +62 -0
  27. data/lib/appwrite/models/file_list.rb +32 -0
  28. data/lib/appwrite/models/function.rb +92 -0
  29. data/lib/appwrite/models/function_list.rb +32 -0
  30. data/lib/appwrite/models/health_antivirus.rb +32 -0
  31. data/lib/appwrite/models/health_queue.rb +27 -0
  32. data/lib/appwrite/models/health_status.rb +32 -0
  33. data/lib/appwrite/models/health_time.rb +37 -0
  34. data/lib/appwrite/models/index.rb +47 -0
  35. data/lib/appwrite/models/index_list.rb +32 -0
  36. data/lib/appwrite/models/language.rb +37 -0
  37. data/lib/appwrite/models/language_list.rb +32 -0
  38. data/lib/appwrite/models/locale.rb +57 -0
  39. data/lib/appwrite/models/log.rb +127 -0
  40. data/lib/appwrite/models/log_list.rb +32 -0
  41. data/lib/appwrite/models/membership.rb +67 -0
  42. data/lib/appwrite/models/membership_list.rb +32 -0
  43. data/lib/appwrite/models/phone.rb +37 -0
  44. data/lib/appwrite/models/phone_list.rb +32 -0
  45. data/lib/appwrite/models/preferences.rb +30 -0
  46. data/lib/appwrite/models/runtime.rb +57 -0
  47. data/lib/appwrite/models/runtime_list.rb +32 -0
  48. data/lib/appwrite/models/session.rb +132 -0
  49. data/lib/appwrite/models/session_list.rb +32 -0
  50. data/lib/appwrite/models/tag.rb +47 -0
  51. data/lib/appwrite/models/tag_list.rb +32 -0
  52. data/lib/appwrite/models/team.rb +42 -0
  53. data/lib/appwrite/models/team_list.rb +32 -0
  54. data/lib/appwrite/models/token.rb +42 -0
  55. data/lib/appwrite/models/user.rb +62 -0
  56. data/lib/appwrite/models/user_list.rb +32 -0
  57. data/lib/appwrite/query.rb +42 -0
  58. data/lib/appwrite/service.rb +0 -5
  59. data/lib/appwrite/services/account.rb +380 -133
  60. data/lib/appwrite/services/avatars.rb +189 -125
  61. data/lib/appwrite/services/database.rb +876 -130
  62. data/lib/appwrite/services/functions.rb +366 -184
  63. data/lib/appwrite/services/health.rb +202 -58
  64. data/lib/appwrite/services/locale.rb +134 -32
  65. data/lib/appwrite/services/storage.rb +211 -118
  66. data/lib/appwrite/services/teams.rb +299 -118
  67. data/lib/appwrite/services/users.rb +372 -85
  68. data/lib/appwrite.rb +55 -0
  69. metadata +72 -103
  70. data/.travis.yml +0 -16
  71. data/CHANGELOG.md +0 -1
  72. data/Gemfile +0 -4
  73. data/LICENSE +0 -12
  74. data/README.md +0 -97
  75. data/appwrite.gemspec +0 -11
  76. data/docs/examples/account/create-recovery.md +0 -15
  77. data/docs/examples/account/create-verification.md +0 -15
  78. data/docs/examples/account/delete-session.md +0 -15
  79. data/docs/examples/account/delete-sessions.md +0 -15
  80. data/docs/examples/account/delete.md +0 -15
  81. data/docs/examples/account/get-logs.md +0 -15
  82. data/docs/examples/account/get-prefs.md +0 -15
  83. data/docs/examples/account/get-sessions.md +0 -15
  84. data/docs/examples/account/get.md +0 -15
  85. data/docs/examples/account/update-email.md +0 -15
  86. data/docs/examples/account/update-name.md +0 -15
  87. data/docs/examples/account/update-password.md +0 -15
  88. data/docs/examples/account/update-prefs.md +0 -15
  89. data/docs/examples/account/update-recovery.md +0 -15
  90. data/docs/examples/account/update-verification.md +0 -15
  91. data/docs/examples/avatars/get-browser.md +0 -15
  92. data/docs/examples/avatars/get-credit-card.md +0 -15
  93. data/docs/examples/avatars/get-favicon.md +0 -15
  94. data/docs/examples/avatars/get-flag.md +0 -15
  95. data/docs/examples/avatars/get-image.md +0 -15
  96. data/docs/examples/avatars/get-initials.md +0 -15
  97. data/docs/examples/avatars/get-q-r.md +0 -15
  98. data/docs/examples/database/create-collection.md +0 -15
  99. data/docs/examples/database/create-document.md +0 -15
  100. data/docs/examples/database/delete-collection.md +0 -15
  101. data/docs/examples/database/delete-document.md +0 -15
  102. data/docs/examples/database/get-collection.md +0 -15
  103. data/docs/examples/database/get-document.md +0 -15
  104. data/docs/examples/database/list-collections.md +0 -15
  105. data/docs/examples/database/list-documents.md +0 -15
  106. data/docs/examples/database/update-collection.md +0 -15
  107. data/docs/examples/database/update-document.md +0 -15
  108. data/docs/examples/functions/create-execution.md +0 -15
  109. data/docs/examples/functions/create-tag.md +0 -15
  110. data/docs/examples/functions/create.md +0 -15
  111. data/docs/examples/functions/delete-tag.md +0 -15
  112. data/docs/examples/functions/delete.md +0 -15
  113. data/docs/examples/functions/get-execution.md +0 -15
  114. data/docs/examples/functions/get-tag.md +0 -15
  115. data/docs/examples/functions/get.md +0 -15
  116. data/docs/examples/functions/list-executions.md +0 -15
  117. data/docs/examples/functions/list-tags.md +0 -15
  118. data/docs/examples/functions/list.md +0 -15
  119. data/docs/examples/functions/update-tag.md +0 -15
  120. data/docs/examples/functions/update.md +0 -15
  121. data/docs/examples/health/get-anti-virus.md +0 -15
  122. data/docs/examples/health/get-cache.md +0 -15
  123. data/docs/examples/health/get-d-b.md +0 -15
  124. data/docs/examples/health/get-queue-certificates.md +0 -15
  125. data/docs/examples/health/get-queue-functions.md +0 -15
  126. data/docs/examples/health/get-queue-logs.md +0 -15
  127. data/docs/examples/health/get-queue-tasks.md +0 -15
  128. data/docs/examples/health/get-queue-usage.md +0 -15
  129. data/docs/examples/health/get-queue-webhooks.md +0 -15
  130. data/docs/examples/health/get-storage-local.md +0 -15
  131. data/docs/examples/health/get-time.md +0 -15
  132. data/docs/examples/health/get.md +0 -15
  133. data/docs/examples/locale/get-continents.md +0 -15
  134. data/docs/examples/locale/get-countries-e-u.md +0 -15
  135. data/docs/examples/locale/get-countries-phones.md +0 -15
  136. data/docs/examples/locale/get-countries.md +0 -15
  137. data/docs/examples/locale/get-currencies.md +0 -15
  138. data/docs/examples/locale/get-languages.md +0 -15
  139. data/docs/examples/locale/get.md +0 -15
  140. data/docs/examples/storage/create-file.md +0 -15
  141. data/docs/examples/storage/delete-file.md +0 -15
  142. data/docs/examples/storage/get-file-download.md +0 -15
  143. data/docs/examples/storage/get-file-preview.md +0 -15
  144. data/docs/examples/storage/get-file-view.md +0 -15
  145. data/docs/examples/storage/get-file.md +0 -15
  146. data/docs/examples/storage/list-files.md +0 -15
  147. data/docs/examples/storage/update-file.md +0 -15
  148. data/docs/examples/teams/create-membership.md +0 -15
  149. data/docs/examples/teams/create.md +0 -15
  150. data/docs/examples/teams/delete-membership.md +0 -15
  151. data/docs/examples/teams/delete.md +0 -15
  152. data/docs/examples/teams/get-memberships.md +0 -15
  153. data/docs/examples/teams/get.md +0 -15
  154. data/docs/examples/teams/list.md +0 -15
  155. data/docs/examples/teams/update-membership-roles.md +0 -15
  156. data/docs/examples/teams/update-membership-status.md +0 -15
  157. data/docs/examples/teams/update.md +0 -15
  158. data/docs/examples/users/create.md +0 -15
  159. data/docs/examples/users/delete-session.md +0 -15
  160. data/docs/examples/users/delete-sessions.md +0 -15
  161. data/docs/examples/users/delete.md +0 -15
  162. data/docs/examples/users/get-logs.md +0 -15
  163. data/docs/examples/users/get-prefs.md +0 -15
  164. data/docs/examples/users/get-sessions.md +0 -15
  165. data/docs/examples/users/get.md +0 -15
  166. data/docs/examples/users/list.md +0 -15
  167. data/docs/examples/users/update-prefs.md +0 -15
  168. data/docs/examples/users/update-status.md +0 -15
@@ -0,0 +1,57 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeIp
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :required
10
+ attr_reader :array
11
+ attr_reader :format
12
+ attr_reader :default
13
+
14
+ def initialize(
15
+ key:,
16
+ type:,
17
+ status:,
18
+ required:,
19
+ array: ,
20
+ format:,
21
+ default:
22
+ )
23
+ @key = key
24
+ @type = type
25
+ @status = status
26
+ @required = required
27
+ @array = array
28
+ @format = format
29
+ @default = default
30
+ end
31
+
32
+ def self.from(map:)
33
+ AttributeIp.new(
34
+ key: map["key"],
35
+ type: map["type"],
36
+ status: map["status"],
37
+ required: map["required"],
38
+ array: map["array"],
39
+ format: map["format"],
40
+ default: map["default"]
41
+ )
42
+ end
43
+
44
+ def to_map
45
+ {
46
+ "key": @key,
47
+ "type": @type,
48
+ "status": @status,
49
+ "required": @required,
50
+ "array": @array,
51
+ "format": @format,
52
+ "default": @default
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeList
6
+ attr_reader :sum
7
+ attr_reader :attributes
8
+
9
+ def initialize(
10
+ sum:,
11
+ attributes:
12
+ )
13
+ @sum = sum
14
+ @attributes = attributes
15
+ end
16
+
17
+ def self.from(map:)
18
+ AttributeList.new(
19
+ sum: map["sum"],
20
+ attributes: map["attributes"]
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "sum": @sum,
27
+ "attributes": @attributes
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,57 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeString
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :required
10
+ attr_reader :array
11
+ attr_reader :size
12
+ attr_reader :default
13
+
14
+ def initialize(
15
+ key:,
16
+ type:,
17
+ status:,
18
+ required:,
19
+ array: ,
20
+ size:,
21
+ default:
22
+ )
23
+ @key = key
24
+ @type = type
25
+ @status = status
26
+ @required = required
27
+ @array = array
28
+ @size = size
29
+ @default = default
30
+ end
31
+
32
+ def self.from(map:)
33
+ AttributeString.new(
34
+ key: map["key"],
35
+ type: map["type"],
36
+ status: map["status"],
37
+ required: map["required"],
38
+ array: map["array"],
39
+ size: map["size"],
40
+ default: map["default"]
41
+ )
42
+ end
43
+
44
+ def to_map
45
+ {
46
+ "key": @key,
47
+ "type": @type,
48
+ "status": @status,
49
+ "required": @required,
50
+ "array": @array,
51
+ "size": @size,
52
+ "default": @default
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,57 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class AttributeUrl
6
+ attr_reader :key
7
+ attr_reader :type
8
+ attr_reader :status
9
+ attr_reader :required
10
+ attr_reader :array
11
+ attr_reader :format
12
+ attr_reader :default
13
+
14
+ def initialize(
15
+ key:,
16
+ type:,
17
+ status:,
18
+ required:,
19
+ array: ,
20
+ format:,
21
+ default:
22
+ )
23
+ @key = key
24
+ @type = type
25
+ @status = status
26
+ @required = required
27
+ @array = array
28
+ @format = format
29
+ @default = default
30
+ end
31
+
32
+ def self.from(map:)
33
+ AttributeUrl.new(
34
+ key: map["key"],
35
+ type: map["type"],
36
+ status: map["status"],
37
+ required: map["required"],
38
+ array: map["array"],
39
+ format: map["format"],
40
+ default: map["default"]
41
+ )
42
+ end
43
+
44
+ def to_map
45
+ {
46
+ "key": @key,
47
+ "type": @type,
48
+ "status": @status,
49
+ "required": @required,
50
+ "array": @array,
51
+ "format": @format,
52
+ "default": @default
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,62 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Collection
6
+ attr_reader :id
7
+ attr_reader :read
8
+ attr_reader :write
9
+ attr_reader :name
10
+ attr_reader :enabled
11
+ attr_reader :permission
12
+ attr_reader :attributes
13
+ attr_reader :indexes
14
+
15
+ def initialize(
16
+ id:,
17
+ read:,
18
+ write:,
19
+ name:,
20
+ enabled:,
21
+ permission:,
22
+ attributes:,
23
+ indexes:
24
+ )
25
+ @id = id
26
+ @read = read
27
+ @write = write
28
+ @name = name
29
+ @enabled = enabled
30
+ @permission = permission
31
+ @attributes = attributes
32
+ @indexes = indexes
33
+ end
34
+
35
+ def self.from(map:)
36
+ Collection.new(
37
+ id: map["$id"],
38
+ read: map["$read"],
39
+ write: map["$write"],
40
+ name: map["name"],
41
+ enabled: map["enabled"],
42
+ permission: map["permission"],
43
+ attributes: map["attributes"],
44
+ indexes: map["indexes"].map { |it| Index.from(map: it) }
45
+ )
46
+ end
47
+
48
+ def to_map
49
+ {
50
+ "$id": @id,
51
+ "$read": @read,
52
+ "$write": @write,
53
+ "name": @name,
54
+ "enabled": @enabled,
55
+ "permission": @permission,
56
+ "attributes": @attributes,
57
+ "indexes": @indexes.map { |it| it.to_map }
58
+ }
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class CollectionList
6
+ attr_reader :sum
7
+ attr_reader :collections
8
+
9
+ def initialize(
10
+ sum:,
11
+ collections:
12
+ )
13
+ @sum = sum
14
+ @collections = collections
15
+ end
16
+
17
+ def self.from(map:)
18
+ CollectionList.new(
19
+ sum: map["sum"],
20
+ collections: map["collections"].map { |it| Collection.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "sum": @sum,
27
+ "collections": @collections.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Continent
6
+ attr_reader :name
7
+ attr_reader :code
8
+
9
+ def initialize(
10
+ name:,
11
+ code:
12
+ )
13
+ @name = name
14
+ @code = code
15
+ end
16
+
17
+ def self.from(map:)
18
+ Continent.new(
19
+ name: map["name"],
20
+ code: map["code"]
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "name": @name,
27
+ "code": @code
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class ContinentList
6
+ attr_reader :sum
7
+ attr_reader :continents
8
+
9
+ def initialize(
10
+ sum:,
11
+ continents:
12
+ )
13
+ @sum = sum
14
+ @continents = continents
15
+ end
16
+
17
+ def self.from(map:)
18
+ ContinentList.new(
19
+ sum: map["sum"],
20
+ continents: map["continents"].map { |it| Continent.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "sum": @sum,
27
+ "continents": @continents.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Country
6
+ attr_reader :name
7
+ attr_reader :code
8
+
9
+ def initialize(
10
+ name:,
11
+ code:
12
+ )
13
+ @name = name
14
+ @code = code
15
+ end
16
+
17
+ def self.from(map:)
18
+ Country.new(
19
+ name: map["name"],
20
+ code: map["code"]
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "name": @name,
27
+ "code": @code
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class CountryList
6
+ attr_reader :sum
7
+ attr_reader :countries
8
+
9
+ def initialize(
10
+ sum:,
11
+ countries:
12
+ )
13
+ @sum = sum
14
+ @countries = countries
15
+ end
16
+
17
+ def self.from(map:)
18
+ CountryList.new(
19
+ sum: map["sum"],
20
+ countries: map["countries"].map { |it| Country.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "sum": @sum,
27
+ "countries": @countries.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,57 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Currency
6
+ attr_reader :symbol
7
+ attr_reader :name
8
+ attr_reader :symbol_native
9
+ attr_reader :decimal_digits
10
+ attr_reader :rounding
11
+ attr_reader :code
12
+ attr_reader :name_plural
13
+
14
+ def initialize(
15
+ symbol:,
16
+ name:,
17
+ symbol_native:,
18
+ decimal_digits:,
19
+ rounding:,
20
+ code:,
21
+ name_plural:
22
+ )
23
+ @symbol = symbol
24
+ @name = name
25
+ @symbol_native = symbol_native
26
+ @decimal_digits = decimal_digits
27
+ @rounding = rounding
28
+ @code = code
29
+ @name_plural = name_plural
30
+ end
31
+
32
+ def self.from(map:)
33
+ Currency.new(
34
+ symbol: map["symbol"],
35
+ name: map["name"],
36
+ symbol_native: map["symbolNative"],
37
+ decimal_digits: map["decimalDigits"],
38
+ rounding: map["rounding"],
39
+ code: map["code"],
40
+ name_plural: map["namePlural"]
41
+ )
42
+ end
43
+
44
+ def to_map
45
+ {
46
+ "symbol": @symbol,
47
+ "name": @name,
48
+ "symbolNative": @symbol_native,
49
+ "decimalDigits": @decimal_digits,
50
+ "rounding": @rounding,
51
+ "code": @code,
52
+ "namePlural": @name_plural
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class CurrencyList
6
+ attr_reader :sum
7
+ attr_reader :currencies
8
+
9
+ def initialize(
10
+ sum:,
11
+ currencies:
12
+ )
13
+ @sum = sum
14
+ @currencies = currencies
15
+ end
16
+
17
+ def self.from(map:)
18
+ CurrencyList.new(
19
+ sum: map["sum"],
20
+ currencies: map["currencies"].map { |it| Currency.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "sum": @sum,
27
+ "currencies": @currencies.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,50 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Document
6
+ attr_reader :id
7
+ attr_reader :collection
8
+ attr_reader :read
9
+ attr_reader :write
10
+
11
+ def initialize(
12
+ id:,
13
+ collection:,
14
+ read:,
15
+ write:,
16
+ data:
17
+ )
18
+ @id = id
19
+ @collection = collection
20
+ @read = read
21
+ @write = write
22
+ @data = data
23
+ end
24
+
25
+ def self.from(map:)
26
+ Document.new(
27
+ id: map["$id"],
28
+ collection: map["$collection"],
29
+ read: map["$read"],
30
+ write: map["$write"],
31
+ data: map["data"]
32
+ )
33
+ end
34
+
35
+ def to_map
36
+ {
37
+ "$id": @id,
38
+ "$collection": @collection,
39
+ "$read": @read,
40
+ "$write": @write,
41
+ "data": @data
42
+ }
43
+ end
44
+
45
+ def convert_to(from_json)
46
+ from_json.call(data)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,36 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class DocumentList
6
+ attr_reader :sum
7
+ attr_reader :documents
8
+
9
+ def initialize(
10
+ sum:,
11
+ documents:
12
+ )
13
+ @sum = sum
14
+ @documents = documents
15
+ end
16
+
17
+ def self.from(map:)
18
+ DocumentList.new(
19
+ sum: map["sum"],
20
+ documents: map["documents"].map { |it| Document.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "sum": @sum,
27
+ "documents": @documents.map { |it| it.to_map }
28
+ }
29
+ end
30
+
31
+ def convert_to(from_json)
32
+ documents.map { |it| it.convert_to(from_json) }
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,72 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Execution
6
+ attr_reader :id
7
+ attr_reader :read
8
+ attr_reader :function_id
9
+ attr_reader :date_created
10
+ attr_reader :trigger
11
+ attr_reader :status
12
+ attr_reader :exit_code
13
+ attr_reader :stdout
14
+ attr_reader :stderr
15
+ attr_reader :time
16
+
17
+ def initialize(
18
+ id:,
19
+ read:,
20
+ function_id:,
21
+ date_created:,
22
+ trigger:,
23
+ status:,
24
+ exit_code:,
25
+ stdout:,
26
+ stderr:,
27
+ time:
28
+ )
29
+ @id = id
30
+ @read = read
31
+ @function_id = function_id
32
+ @date_created = date_created
33
+ @trigger = trigger
34
+ @status = status
35
+ @exit_code = exit_code
36
+ @stdout = stdout
37
+ @stderr = stderr
38
+ @time = time
39
+ end
40
+
41
+ def self.from(map:)
42
+ Execution.new(
43
+ id: map["$id"],
44
+ read: map["$read"],
45
+ function_id: map["functionId"],
46
+ date_created: map["dateCreated"],
47
+ trigger: map["trigger"],
48
+ status: map["status"],
49
+ exit_code: map["exitCode"],
50
+ stdout: map["stdout"],
51
+ stderr: map["stderr"],
52
+ time: map["time"]
53
+ )
54
+ end
55
+
56
+ def to_map
57
+ {
58
+ "$id": @id,
59
+ "$read": @read,
60
+ "functionId": @function_id,
61
+ "dateCreated": @date_created,
62
+ "trigger": @trigger,
63
+ "status": @status,
64
+ "exitCode": @exit_code,
65
+ "stdout": @stdout,
66
+ "stderr": @stderr,
67
+ "time": @time
68
+ }
69
+ end
70
+ end
71
+ end
72
+ end