phrase 2.0.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -3
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountDetails.md +5 -1
  5. data/docs/AccountDetails1.md +3 -1
  6. data/docs/AccountSearchResult.md +29 -0
  7. data/docs/Branch.md +5 -1
  8. data/docs/Comment.md +3 -1
  9. data/docs/JobCreateParameters.md +2 -0
  10. data/docs/JobDetails.md +2 -0
  11. data/docs/JobDetails1.md +2 -0
  12. data/docs/JobTemplate.md +29 -0
  13. data/docs/JobTemplateCreateParameters.md +21 -0
  14. data/docs/JobTemplateLocale.md +23 -0
  15. data/docs/JobTemplateLocaleUpdateParameters.md +23 -0
  16. data/docs/JobTemplateLocalesApi.md +347 -0
  17. data/docs/JobTemplateLocalesCreateParameters.md +23 -0
  18. data/docs/JobTemplatePreview.md +19 -0
  19. data/docs/JobTemplateUpdateParameters.md +21 -0
  20. data/docs/JobTemplateUserPreview.md +23 -0
  21. data/docs/JobTemplatesApi.md +337 -0
  22. data/docs/KeysApi.md +132 -4
  23. data/docs/KeysExcludeParameters.md +23 -0
  24. data/docs/KeysIncludeParameters.md +23 -0
  25. data/docs/KeysSearchParameters.md +1 -1
  26. data/docs/KeysTagParameters.md +1 -1
  27. data/docs/KeysUntagParameters.md +1 -1
  28. data/docs/LocalePreview1.md +23 -0
  29. data/docs/LocalesApi.md +73 -3
  30. data/docs/MemberSpaces.md +2 -2
  31. data/docs/MemberUpdateParameters.md +4 -2
  32. data/docs/Notification.md +41 -0
  33. data/docs/NotificationGroup.md +23 -0
  34. data/docs/NotificationGroupDetail.md +27 -0
  35. data/docs/NotificationGroupsApi.md +194 -0
  36. data/docs/NotificationsApi.md +194 -0
  37. data/docs/OrderCreateParameters.md +2 -0
  38. data/docs/Project.md +2 -0
  39. data/docs/ProjectCreateParameters.md +35 -1
  40. data/docs/ProjectDetails.md +2 -0
  41. data/docs/ProjectsApi.md +7 -1
  42. data/docs/SearchApi.md +72 -0
  43. data/docs/SearchInAccountParameters.md +23 -0
  44. data/docs/Space1.md +25 -0
  45. data/docs/Subscription.md +19 -0
  46. data/docs/TranslationOrder.md +2 -0
  47. data/docs/TranslationsVerifyParameters.md +3 -5
  48. data/docs/User.md +0 -2
  49. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  50. data/lib/phrase/api/job_templates_api.rb +387 -0
  51. data/lib/phrase/api/keys_api.rb +152 -4
  52. data/lib/phrase/api/locales_api.rb +80 -2
  53. data/lib/phrase/api/notification_groups_api.rb +202 -0
  54. data/lib/phrase/api/notifications_api.rb +202 -0
  55. data/lib/phrase/api/projects_api.rb +9 -0
  56. data/lib/phrase/api/search_api.rb +84 -0
  57. data/lib/phrase/models/account.rb +13 -4
  58. data/lib/phrase/models/account_details.rb +22 -4
  59. data/lib/phrase/models/account_details1.rb +10 -1
  60. data/lib/phrase/models/account_search_result.rb +250 -0
  61. data/lib/phrase/models/branch.rb +19 -1
  62. data/lib/phrase/models/comment.rb +15 -4
  63. data/lib/phrase/models/job_create_parameters.rb +11 -1
  64. data/lib/phrase/models/job_details.rb +10 -1
  65. data/lib/phrase/models/job_details1.rb +10 -1
  66. data/lib/phrase/models/job_template.rb +248 -0
  67. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  68. data/lib/phrase/models/job_template_locale.rb +223 -0
  69. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  70. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  71. data/lib/phrase/models/job_template_preview.rb +203 -0
  72. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  73. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  74. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  75. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  76. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  77. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  78. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  79. data/lib/phrase/models/locale_preview1.rb +221 -0
  80. data/lib/phrase/models/member_spaces.rb +2 -2
  81. data/lib/phrase/models/member_update_parameters.rb +12 -2
  82. data/lib/phrase/models/notification.rb +302 -0
  83. data/lib/phrase/models/notification_group.rb +221 -0
  84. data/lib/phrase/models/notification_group_detail.rb +239 -0
  85. data/lib/phrase/models/order_create_parameters.rb +11 -1
  86. data/lib/phrase/models/project.rb +10 -1
  87. data/lib/phrase/models/project_create_parameters.rb +174 -4
  88. data/lib/phrase/models/project_details.rb +10 -1
  89. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  90. data/lib/phrase/models/space1.rb +230 -0
  91. data/lib/phrase/models/subscription.rb +203 -0
  92. data/lib/phrase/models/translation_order.rb +10 -1
  93. data/lib/phrase/models/translations_verify_parameters.rb +14 -24
  94. data/lib/phrase/models/user.rb +1 -10
  95. data/lib/phrase/version.rb +1 -1
  96. data/lib/phrase.rb +23 -0
  97. data/spec/api/job_template_locales_api_spec.rb +103 -0
  98. data/spec/api/job_templates_api_spec.rb +98 -0
  99. data/spec/api/keys_api_spec.rb +30 -2
  100. data/spec/api/locales_api_spec.rb +18 -1
  101. data/spec/api/notification_groups_api_spec.rb +62 -0
  102. data/spec/api/notifications_api_spec.rb +62 -0
  103. data/spec/api/projects_api_spec.rb +3 -0
  104. data/spec/api/search_api_spec.rb +37 -0
  105. data/spec/models/account_details1_spec.rb +6 -0
  106. data/spec/models/account_details_spec.rb +12 -0
  107. data/spec/models/account_search_result_spec.rb +65 -0
  108. data/spec/models/account_spec.rb +6 -0
  109. data/spec/models/branch_spec.rb +12 -0
  110. data/spec/models/comment_spec.rb +6 -0
  111. data/spec/models/job_create_parameters_spec.rb +6 -0
  112. data/spec/models/job_details1_spec.rb +6 -0
  113. data/spec/models/job_details_spec.rb +6 -0
  114. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  115. data/spec/models/job_template_locale_spec.rb +47 -0
  116. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  117. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  118. data/spec/models/job_template_preview_spec.rb +35 -0
  119. data/spec/models/job_template_spec.rb +65 -0
  120. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  121. data/spec/models/job_template_user_preview_spec.rb +47 -0
  122. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  123. data/spec/models/keys_include_parameters_spec.rb +47 -0
  124. data/spec/models/locale_preview1_spec.rb +47 -0
  125. data/spec/models/member_update_parameters_spec.rb +6 -0
  126. data/spec/models/notification_group_detail_spec.rb +59 -0
  127. data/spec/models/notification_group_spec.rb +47 -0
  128. data/spec/models/notification_spec.rb +101 -0
  129. data/spec/models/order_create_parameters_spec.rb +6 -0
  130. data/spec/models/project_create_parameters_spec.rb +102 -0
  131. data/spec/models/project_details_spec.rb +6 -0
  132. data/spec/models/project_spec.rb +6 -0
  133. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  134. data/spec/models/space1_spec.rb +53 -0
  135. data/spec/models/subscription_spec.rb +35 -0
  136. data/spec/models/translation_order_spec.rb +6 -0
  137. data/spec/models/translations_verify_parameters_spec.rb +2 -8
  138. data/spec/models/user_spec.rb +0 -6
  139. metadata +262 -170
@@ -11,7 +11,7 @@ module Phrase
11
11
  # Order direction. Can be one of: asc, desc.
12
12
  attr_accessor :order
13
13
 
14
- # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - whitespaces need to be prefixed with a backspace (\\\"\\\\\\\")</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
14
+ # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
15
15
  attr_accessor :q
16
16
 
17
17
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
@@ -5,7 +5,7 @@ module Phrase
5
5
  # specify the branch to use
6
6
  attr_accessor :branch
7
7
 
8
- # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - whitespaces need to be prefixed with a backspace (\\\"\\\\\\\")</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
8
+ # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
9
9
  attr_accessor :q
10
10
 
11
11
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
@@ -5,7 +5,7 @@ module Phrase
5
5
  # specify the branch to use
6
6
  attr_accessor :branch
7
7
 
8
- # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - whitespaces need to be prefixed with a backspace (\\\"\\\\\\\")</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
8
+ # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
9
9
  attr_accessor :q
10
10
 
11
11
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
@@ -0,0 +1,221 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class LocalePreview1
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :code
10
+
11
+ attr_accessor :project
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'id' => :'id',
17
+ :'name' => :'name',
18
+ :'code' => :'code',
19
+ :'project' => :'project'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'id' => :'String',
27
+ :'name' => :'String',
28
+ :'code' => :'String',
29
+ :'project' => :'ProjectShort'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::LocalePreview1` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::LocalePreview1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'id')
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes.key?(:'name')
59
+ self.name = attributes[:'name']
60
+ end
61
+
62
+ if attributes.key?(:'code')
63
+ self.code = attributes[:'code']
64
+ end
65
+
66
+ if attributes.key?(:'project')
67
+ self.project = attributes[:'project']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ id == o.id &&
90
+ name == o.name &&
91
+ code == o.code &&
92
+ project == o.project
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [id, name, code, project].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ Phrase.const_get(type).build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end
@@ -28,8 +28,8 @@ module Phrase
28
28
  {
29
29
  :'id' => :'String',
30
30
  :'name' => :'String',
31
- :'created_at' => :'AnyType',
32
- :'updated_at' => :'AnyType',
31
+ :'created_at' => :'DateTime',
32
+ :'updated_at' => :'DateTime',
33
33
  :'projects_count' => :'Integer'
34
34
  }
35
35
  end
@@ -2,7 +2,10 @@ require 'date'
2
2
 
3
3
  module Phrase
4
4
  class MemberUpdateParameters
5
- # Member role, can be any of of Manager, Developer, Translator
5
+ # Update strategy, can be any of set, add, remove. If provided, it will set, add or remove given spaces, projects and locale ids from users access list.
6
+ attr_accessor :strategy
7
+
8
+ # Member role, can be any of of Admin, ProjectManager, Developer, Designer, Translator
6
9
  attr_accessor :role
7
10
 
8
11
  # List of project ids the user has access to.
@@ -23,6 +26,7 @@ module Phrase
23
26
  # Attribute mapping from ruby-style variable name to JSON key.
24
27
  def self.attribute_map
25
28
  {
29
+ :'strategy' => :'strategy',
26
30
  :'role' => :'role',
27
31
  :'project_ids' => :'project_ids',
28
32
  :'locale_ids' => :'locale_ids',
@@ -35,6 +39,7 @@ module Phrase
35
39
  # Attribute type mapping.
36
40
  def self.openapi_types
37
41
  {
42
+ :'strategy' => :'String',
38
43
  :'role' => :'String',
39
44
  :'project_ids' => :'String',
40
45
  :'locale_ids' => :'String',
@@ -65,6 +70,10 @@ module Phrase
65
70
  h[k.to_sym] = v
66
71
  }
67
72
 
73
+ if attributes.key?(:'strategy')
74
+ self.strategy = attributes[:'strategy']
75
+ end
76
+
68
77
  if attributes.key?(:'role')
69
78
  self.role = attributes[:'role']
70
79
  end
@@ -114,6 +123,7 @@ module Phrase
114
123
  def ==(o)
115
124
  return true if self.equal?(o)
116
125
  self.class == o.class &&
126
+ strategy == o.strategy &&
117
127
  role == o.role &&
118
128
  project_ids == o.project_ids &&
119
129
  locale_ids == o.locale_ids &&
@@ -131,7 +141,7 @@ module Phrase
131
141
  # Calculates hash code according to all attributes.
132
142
  # @return [Integer] Hash code
133
143
  def hash
134
- [role, project_ids, locale_ids, default_locale_codes, space_ids, permissions].hash
144
+ [strategy, role, project_ids, locale_ids, default_locale_codes, space_ids, permissions].hash
135
145
  end
136
146
 
137
147
  # Builds the object from hash
@@ -0,0 +1,302 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class Notification
5
+ attr_accessor :id
6
+
7
+ attr_accessor :event_name
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ attr_accessor :delivered_at
14
+
15
+ attr_accessor :seen_at
16
+
17
+ attr_accessor :data
18
+
19
+ attr_accessor :resource
20
+
21
+ attr_accessor :locale
22
+
23
+ attr_accessor :user
24
+
25
+ attr_accessor :project
26
+
27
+ attr_accessor :account
28
+
29
+ attr_accessor :group
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'id' => :'id',
35
+ :'event_name' => :'event_name',
36
+ :'created_at' => :'created_at',
37
+ :'updated_at' => :'updated_at',
38
+ :'delivered_at' => :'delivered_at',
39
+ :'seen_at' => :'seen_at',
40
+ :'data' => :'data',
41
+ :'resource' => :'resource',
42
+ :'locale' => :'locale',
43
+ :'user' => :'user',
44
+ :'project' => :'project',
45
+ :'account' => :'account',
46
+ :'group' => :'group'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'id' => :'String',
54
+ :'event_name' => :'String',
55
+ :'created_at' => :'DateTime',
56
+ :'updated_at' => :'DateTime',
57
+ :'delivered_at' => :'DateTime',
58
+ :'seen_at' => :'DateTime',
59
+ :'data' => :'Object',
60
+ :'resource' => :'Object',
61
+ :'locale' => :'Locale',
62
+ :'user' => :'UserPreview',
63
+ :'project' => :'Project',
64
+ :'account' => :'Account',
65
+ :'group' => :'NotificationGroup'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::Notification` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::Notification`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'id')
91
+ self.id = attributes[:'id']
92
+ end
93
+
94
+ if attributes.key?(:'event_name')
95
+ self.event_name = attributes[:'event_name']
96
+ end
97
+
98
+ if attributes.key?(:'created_at')
99
+ self.created_at = attributes[:'created_at']
100
+ end
101
+
102
+ if attributes.key?(:'updated_at')
103
+ self.updated_at = attributes[:'updated_at']
104
+ end
105
+
106
+ if attributes.key?(:'delivered_at')
107
+ self.delivered_at = attributes[:'delivered_at']
108
+ end
109
+
110
+ if attributes.key?(:'seen_at')
111
+ self.seen_at = attributes[:'seen_at']
112
+ end
113
+
114
+ if attributes.key?(:'data')
115
+ self.data = attributes[:'data']
116
+ end
117
+
118
+ if attributes.key?(:'resource')
119
+ self.resource = attributes[:'resource']
120
+ end
121
+
122
+ if attributes.key?(:'locale')
123
+ self.locale = attributes[:'locale']
124
+ end
125
+
126
+ if attributes.key?(:'user')
127
+ self.user = attributes[:'user']
128
+ end
129
+
130
+ if attributes.key?(:'project')
131
+ self.project = attributes[:'project']
132
+ end
133
+
134
+ if attributes.key?(:'account')
135
+ self.account = attributes[:'account']
136
+ end
137
+
138
+ if attributes.key?(:'group')
139
+ self.group = attributes[:'group']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ invalid_properties = Array.new
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ true
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ id == o.id &&
162
+ event_name == o.event_name &&
163
+ created_at == o.created_at &&
164
+ updated_at == o.updated_at &&
165
+ delivered_at == o.delivered_at &&
166
+ seen_at == o.seen_at &&
167
+ data == o.data &&
168
+ resource == o.resource &&
169
+ locale == o.locale &&
170
+ user == o.user &&
171
+ project == o.project &&
172
+ account == o.account &&
173
+ group == o.group
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [id, event_name, created_at, updated_at, delivered_at, seen_at, data, resource, locale, user, project, account, group].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ new.build_from_hash(attributes)
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ self.class.openapi_types.each_pair do |key, type|
201
+ if type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
205
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
206
+ end
207
+ elsif !attributes[self.class.attribute_map[key]].nil?
208
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :DateTime
222
+ DateTime.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :Boolean
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ Phrase.const_get(type).build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+ end
302
+ end