phrase 2.8.3 → 2.9.0

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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +31 -12
  4. data/docs/BitbucketSyncApi.md +2 -2
  5. data/docs/BranchesApi.md +3 -3
  6. data/docs/GitHubSyncApi.md +2 -2
  7. data/docs/GitLabSyncApi.md +2 -2
  8. data/docs/JobCommentsApi.md +6 -6
  9. data/docs/JobLocale.md +3 -1
  10. data/docs/JobLocaleUpdateParameters.md +5 -1
  11. data/docs/JobLocalesCreateParameters.md +6 -2
  12. data/docs/JobTemplateDetails.md +35 -0
  13. data/docs/JobTemplateDetails1.md +21 -0
  14. data/docs/JobTemplateLocaleUpdateParameters.md +6 -2
  15. data/docs/{JobTemplateLocale.md → JobTemplateLocales.md} +6 -4
  16. data/docs/JobTemplateLocalesApi.md +8 -8
  17. data/docs/JobTemplateLocalesCreateParameters.md +5 -1
  18. data/docs/JobTemplatesApi.md +41 -41
  19. data/docs/KeysSearchParameters.md +1 -1
  20. data/docs/LocaleTeamPreview.md +21 -0
  21. data/docs/{JobTemplateUserPreview.md → LocaleUserPreview.md} +2 -2
  22. data/docs/LocalesApi.md +8 -4
  23. data/docs/NotificationGroupDetail.md +1 -1
  24. data/docs/NotificationGroupsApi.md +4 -4
  25. data/docs/NotificationsApi.md +4 -4
  26. data/docs/OrganizationJobTemplate.md +25 -0
  27. data/docs/OrganizationJobTemplateCreateParameters.md +19 -0
  28. data/docs/OrganizationJobTemplateDetails.md +31 -0
  29. data/docs/OrganizationJobTemplateLocaleUpdateParameters.md +27 -0
  30. data/docs/OrganizationJobTemplateLocalesApi.md +341 -0
  31. data/docs/OrganizationJobTemplateLocalesCreateParameters.md +27 -0
  32. data/docs/OrganizationJobTemplateUpdateParameters.md +19 -0
  33. data/docs/OrganizationJobTemplatesApi.md +331 -0
  34. data/docs/Project.md +2 -0
  35. data/docs/ProjectCreateParameters.md +5 -1
  36. data/docs/ProjectDetails.md +2 -0
  37. data/docs/ProjectUpdateParameters.md +5 -1
  38. data/docs/SearchApi.md +1 -1
  39. data/docs/TranslationsApi.md +23 -19
  40. data/docs/TranslationsExcludeParameters.md +1 -1
  41. data/docs/TranslationsIncludeParameters.md +1 -1
  42. data/docs/TranslationsReviewParameters.md +1 -1
  43. data/docs/TranslationsSearchParameters.md +1 -1
  44. data/docs/TranslationsUnverifyParameters.md +1 -1
  45. data/docs/TranslationsVerifyParameters.md +1 -1
  46. data/docs/UploadsApi.md +3 -3
  47. data/lib/phrase/api/bitbucket_sync_api.rb +4 -4
  48. data/lib/phrase/api/branches_api.rb +6 -6
  49. data/lib/phrase/api/git_hub_sync_api.rb +4 -4
  50. data/lib/phrase/api/git_lab_sync_api.rb +4 -4
  51. data/lib/phrase/api/job_comments_api.rb +9 -9
  52. data/lib/phrase/api/job_template_locales_api.rb +12 -12
  53. data/lib/phrase/api/job_templates_api.rb +72 -72
  54. data/lib/phrase/api/locales_api.rb +10 -4
  55. data/lib/phrase/api/notification_groups_api.rb +6 -6
  56. data/lib/phrase/api/notifications_api.rb +6 -6
  57. data/lib/phrase/api/organization_job_template_locales_api.rb +408 -0
  58. data/lib/phrase/api/organization_job_templates_api.rb +378 -0
  59. data/lib/phrase/api/search_api.rb +2 -2
  60. data/lib/phrase/api/translations_api.rb +20 -14
  61. data/lib/phrase/api/uploads_api.rb +2 -2
  62. data/lib/phrase/models/job_locale.rb +13 -2
  63. data/lib/phrase/models/job_locale_update_parameters.rb +28 -4
  64. data/lib/phrase/models/job_locales_create_parameters.rb +33 -4
  65. data/lib/phrase/models/job_template_details.rb +285 -0
  66. data/lib/phrase/models/job_template_details1.rb +214 -0
  67. data/lib/phrase/models/job_template_locale_update_parameters.rb +28 -9
  68. data/lib/phrase/models/{job_template_locale.rb → job_template_locales.rb} +18 -7
  69. data/lib/phrase/models/job_template_locales_create_parameters.rb +28 -4
  70. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  71. data/lib/phrase/models/locale_team_preview.rb +212 -0
  72. data/lib/phrase/models/{job_template_user_preview.rb → locale_user_preview.rb} +3 -3
  73. data/lib/phrase/models/notification_group_detail.rb +1 -1
  74. data/lib/phrase/models/organization_job_template.rb +230 -0
  75. data/lib/phrase/models/organization_job_template_create_parameters.rb +210 -0
  76. data/lib/phrase/models/organization_job_template_details.rb +267 -0
  77. data/lib/phrase/models/organization_job_template_locale_update_parameters.rb +253 -0
  78. data/lib/phrase/models/organization_job_template_locales_create_parameters.rb +263 -0
  79. data/lib/phrase/models/organization_job_template_update_parameters.rb +210 -0
  80. data/lib/phrase/models/project.rb +10 -1
  81. data/lib/phrase/models/project_create_parameters.rb +22 -2
  82. data/lib/phrase/models/project_details.rb +10 -1
  83. data/lib/phrase/models/project_update_parameters.rb +22 -2
  84. data/lib/phrase/models/translations_exclude_parameters.rb +1 -1
  85. data/lib/phrase/models/translations_include_parameters.rb +1 -1
  86. data/lib/phrase/models/translations_review_parameters.rb +1 -1
  87. data/lib/phrase/models/translations_search_parameters.rb +1 -1
  88. data/lib/phrase/models/translations_unverify_parameters.rb +1 -1
  89. data/lib/phrase/models/translations_verify_parameters.rb +1 -1
  90. data/lib/phrase/version.rb +1 -1
  91. data/lib/phrase.rb +13 -2
  92. data/spec/api/bitbucket_sync_api_spec.rb +2 -2
  93. data/spec/api/branches_api_spec.rb +3 -3
  94. data/spec/api/git_hub_sync_api_spec.rb +2 -2
  95. data/spec/api/git_lab_sync_api_spec.rb +2 -2
  96. data/spec/api/job_comments_api_spec.rb +3 -3
  97. data/spec/api/job_template_locales_api_spec.rb +4 -4
  98. data/spec/api/job_templates_api_spec.rb +17 -17
  99. data/spec/api/locales_api_spec.rb +4 -2
  100. data/spec/api/notification_groups_api_spec.rb +2 -2
  101. data/spec/api/notifications_api_spec.rb +2 -2
  102. data/spec/api/organization_job_template_locales_api_spec.rb +100 -0
  103. data/spec/api/organization_job_templates_api_spec.rb +95 -0
  104. data/spec/api/search_api_spec.rb +1 -1
  105. data/spec/api/translations_api_spec.rb +9 -7
  106. data/spec/api/uploads_api_spec.rb +1 -1
  107. data/spec/models/job_locale_spec.rb +6 -0
  108. data/spec/models/job_locale_update_parameters_spec.rb +12 -0
  109. data/spec/models/job_locales_create_parameters_spec.rb +12 -0
  110. data/spec/models/job_template_details1_spec.rb +41 -0
  111. data/spec/models/job_template_details_spec.rb +83 -0
  112. data/spec/models/job_template_locale_update_parameters_spec.rb +12 -0
  113. data/spec/models/job_template_locales_create_parameters_spec.rb +12 -0
  114. data/spec/models/{job_template_locale_spec.rb → job_template_locales_spec.rb} +12 -6
  115. data/spec/models/locale_team_preview_spec.rb +41 -0
  116. data/spec/models/{job_template_user_preview_spec.rb → locale_user_preview_spec.rb} +6 -6
  117. data/spec/models/organization_job_template_create_parameters_spec.rb +35 -0
  118. data/spec/models/organization_job_template_details_spec.rb +71 -0
  119. data/spec/models/organization_job_template_locale_update_parameters_spec.rb +59 -0
  120. data/spec/models/organization_job_template_locales_create_parameters_spec.rb +59 -0
  121. data/spec/models/organization_job_template_spec.rb +53 -0
  122. data/spec/models/organization_job_template_update_parameters_spec.rb +35 -0
  123. data/spec/models/project_create_parameters_spec.rb +12 -0
  124. data/spec/models/project_details_spec.rb +6 -0
  125. data/spec/models/project_spec.rb +6 -0
  126. data/spec/models/project_update_parameters_spec.rb +12 -0
  127. metadata +269 -225
@@ -14,13 +14,21 @@ module Phrase
14
14
  # Array of reviewer ids to be assigned to the job template locale
15
15
  attr_accessor :reviewer_ids
16
16
 
17
+ # Array of team ids to be assigned to the job locale as translators
18
+ attr_accessor :translator_team_ids
19
+
20
+ # Array of team ids to be assigned to the job locale as reviewers
21
+ attr_accessor :reviewer_team_ids
22
+
17
23
  # Attribute mapping from ruby-style variable name to JSON key.
18
24
  def self.attribute_map
19
25
  {
20
26
  :'branch' => :'branch',
21
27
  :'locale_id' => :'locale_id',
22
28
  :'user_ids' => :'user_ids',
23
- :'reviewer_ids' => :'reviewer_ids'
29
+ :'reviewer_ids' => :'reviewer_ids',
30
+ :'translator_team_ids' => :'translator_team_ids',
31
+ :'reviewer_team_ids' => :'reviewer_team_ids'
24
32
  }
25
33
  end
26
34
 
@@ -30,7 +38,9 @@ module Phrase
30
38
  :'branch' => :'String',
31
39
  :'locale_id' => :'String',
32
40
  :'user_ids' => :'Array<String>',
33
- :'reviewer_ids' => :'Array<String>'
41
+ :'reviewer_ids' => :'Array<String>',
42
+ :'translator_team_ids' => :'Array<String>',
43
+ :'reviewer_team_ids' => :'Array<String>'
34
44
  }
35
45
  end
36
46
 
@@ -74,23 +84,30 @@ module Phrase
74
84
  self.reviewer_ids = value
75
85
  end
76
86
  end
87
+
88
+ if attributes.key?(:'translator_team_ids')
89
+ if (value = attributes[:'translator_team_ids']).is_a?(Array)
90
+ self.translator_team_ids = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'reviewer_team_ids')
95
+ if (value = attributes[:'reviewer_team_ids']).is_a?(Array)
96
+ self.reviewer_team_ids = value
97
+ end
98
+ end
77
99
  end
78
100
 
79
101
  # Show invalid properties with the reasons. Usually used together with valid?
80
102
  # @return Array for valid properties with the reasons
81
103
  def list_invalid_properties
82
104
  invalid_properties = Array.new
83
- if @locale_id.nil?
84
- invalid_properties.push('invalid value for "locale_id", locale_id cannot be nil.')
85
- end
86
-
87
105
  invalid_properties
88
106
  end
89
107
 
90
108
  # Check to see if the all the properties in the model are valid
91
109
  # @return true if the model is valid
92
110
  def valid?
93
- return false if @locale_id.nil?
94
111
  true
95
112
  end
96
113
 
@@ -102,7 +119,9 @@ module Phrase
102
119
  branch == o.branch &&
103
120
  locale_id == o.locale_id &&
104
121
  user_ids == o.user_ids &&
105
- reviewer_ids == o.reviewer_ids
122
+ reviewer_ids == o.reviewer_ids &&
123
+ translator_team_ids == o.translator_team_ids &&
124
+ reviewer_team_ids == o.reviewer_team_ids
106
125
  end
107
126
 
108
127
  # @see the `==` method
@@ -114,7 +133,7 @@ module Phrase
114
133
  # Calculates hash code according to all attributes.
115
134
  # @return [Integer] Hash code
116
135
  def hash
117
- [branch, locale_id, user_ids, reviewer_ids].hash
136
+ [branch, locale_id, user_ids, reviewer_ids, translator_team_ids, reviewer_team_ids].hash
118
137
  end
119
138
 
120
139
  # Builds the object from hash
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
 
3
3
  module Phrase
4
- class JobTemplateLocale
4
+ class JobTemplateLocales
5
5
  attr_accessor :id
6
6
 
7
7
  attr_accessor :job_template
@@ -10,13 +10,16 @@ module Phrase
10
10
 
11
11
  attr_accessor :users
12
12
 
13
+ attr_accessor :teams
14
+
13
15
  # Attribute mapping from ruby-style variable name to JSON key.
14
16
  def self.attribute_map
15
17
  {
16
18
  :'id' => :'id',
17
19
  :'job_template' => :'job_template',
18
20
  :'locale' => :'locale',
19
- :'users' => :'users'
21
+ :'users' => :'users',
22
+ :'teams' => :'teams'
20
23
  }
21
24
  end
22
25
 
@@ -26,7 +29,8 @@ module Phrase
26
29
  :'id' => :'String',
27
30
  :'job_template' => :'JobTemplatePreview',
28
31
  :'locale' => :'LocalePreview',
29
- :'users' => :'Array<JobTemplateUserPreview>'
32
+ :'users' => :'Array<LocaleUserPreview>',
33
+ :'teams' => :'Array<LocaleTeamPreview>'
30
34
  }
31
35
  end
32
36
 
@@ -40,13 +44,13 @@ module Phrase
40
44
  # @param [Hash] attributes Model attributes in the form of hash
41
45
  def initialize(attributes = {})
42
46
  if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateLocale` initialize method"
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateLocales` initialize method"
44
48
  end
45
49
 
46
50
  # check to see if the attribute exists and convert string to symbol for hash key
47
51
  attributes = attributes.each_with_object({}) { |(k, v), h|
48
52
  if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateLocale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateLocales`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
54
  end
51
55
  h[k.to_sym] = v
52
56
  }
@@ -68,6 +72,12 @@ module Phrase
68
72
  self.users = value
69
73
  end
70
74
  end
75
+
76
+ if attributes.key?(:'teams')
77
+ if (value = attributes[:'teams']).is_a?(Array)
78
+ self.teams = value
79
+ end
80
+ end
71
81
  end
72
82
 
73
83
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -91,7 +101,8 @@ module Phrase
91
101
  id == o.id &&
92
102
  job_template == o.job_template &&
93
103
  locale == o.locale &&
94
- users == o.users
104
+ users == o.users &&
105
+ teams == o.teams
95
106
  end
96
107
 
97
108
  # @see the `==` method
@@ -103,7 +114,7 @@ module Phrase
103
114
  # Calculates hash code according to all attributes.
104
115
  # @return [Integer] Hash code
105
116
  def hash
106
- [id, job_template, locale, users].hash
117
+ [id, job_template, locale, users, teams].hash
107
118
  end
108
119
 
109
120
  # Builds the object from hash
@@ -14,13 +14,21 @@ module Phrase
14
14
  # Array of reviewer ids to be assigned to the job template locale
15
15
  attr_accessor :reviewer_ids
16
16
 
17
+ # Array of team ids to be assigned to the job locale as translators
18
+ attr_accessor :translator_team_ids
19
+
20
+ # Array of team ids to be assigned to the job locale as reviewers
21
+ attr_accessor :reviewer_team_ids
22
+
17
23
  # Attribute mapping from ruby-style variable name to JSON key.
18
24
  def self.attribute_map
19
25
  {
20
26
  :'branch' => :'branch',
21
27
  :'locale_id' => :'locale_id',
22
28
  :'user_ids' => :'user_ids',
23
- :'reviewer_ids' => :'reviewer_ids'
29
+ :'reviewer_ids' => :'reviewer_ids',
30
+ :'translator_team_ids' => :'translator_team_ids',
31
+ :'reviewer_team_ids' => :'reviewer_team_ids'
24
32
  }
25
33
  end
26
34
 
@@ -30,7 +38,9 @@ module Phrase
30
38
  :'branch' => :'String',
31
39
  :'locale_id' => :'String',
32
40
  :'user_ids' => :'Array<String>',
33
- :'reviewer_ids' => :'Array<String>'
41
+ :'reviewer_ids' => :'Array<String>',
42
+ :'translator_team_ids' => :'Array<String>',
43
+ :'reviewer_team_ids' => :'Array<String>'
34
44
  }
35
45
  end
36
46
 
@@ -74,6 +84,18 @@ module Phrase
74
84
  self.reviewer_ids = value
75
85
  end
76
86
  end
87
+
88
+ if attributes.key?(:'translator_team_ids')
89
+ if (value = attributes[:'translator_team_ids']).is_a?(Array)
90
+ self.translator_team_ids = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'reviewer_team_ids')
95
+ if (value = attributes[:'reviewer_team_ids']).is_a?(Array)
96
+ self.reviewer_team_ids = value
97
+ end
98
+ end
77
99
  end
78
100
 
79
101
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -102,7 +124,9 @@ module Phrase
102
124
  branch == o.branch &&
103
125
  locale_id == o.locale_id &&
104
126
  user_ids == o.user_ids &&
105
- reviewer_ids == o.reviewer_ids
127
+ reviewer_ids == o.reviewer_ids &&
128
+ translator_team_ids == o.translator_team_ids &&
129
+ reviewer_team_ids == o.reviewer_team_ids
106
130
  end
107
131
 
108
132
  # @see the `==` method
@@ -114,7 +138,7 @@ module Phrase
114
138
  # Calculates hash code according to all attributes.
115
139
  # @return [Integer] Hash code
116
140
  def hash
117
- [branch, locale_id, user_ids, reviewer_ids].hash
141
+ [branch, locale_id, user_ids, reviewer_ids, translator_team_ids, reviewer_team_ids].hash
118
142
  end
119
143
 
120
144
  # Builds the object from hash
@@ -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 - 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>.
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>. Please note: If <code>tags</code> are added to filter the search, the search will be limited to a maximum of 65,536 tagged keys.
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.
@@ -0,0 +1,212 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class LocaleTeamPreview
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :role
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'id' => :'id',
15
+ :'name' => :'name',
16
+ :'role' => :'role'
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.openapi_types
22
+ {
23
+ :'id' => :'String',
24
+ :'name' => :'String',
25
+ :'role' => :'String'
26
+ }
27
+ end
28
+
29
+ # List of attributes with nullable: true
30
+ def self.openapi_nullable
31
+ Set.new([
32
+ ])
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ if (!attributes.is_a?(Hash))
39
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::LocaleTeamPreview` initialize method"
40
+ end
41
+
42
+ # check to see if the attribute exists and convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h|
44
+ if (!self.class.attribute_map.key?(k.to_sym))
45
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::LocaleTeamPreview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
46
+ end
47
+ h[k.to_sym] = v
48
+ }
49
+
50
+ if attributes.key?(:'id')
51
+ self.id = attributes[:'id']
52
+ end
53
+
54
+ if attributes.key?(:'name')
55
+ self.name = attributes[:'name']
56
+ end
57
+
58
+ if attributes.key?(:'role')
59
+ self.role = attributes[:'role']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ id == o.id &&
82
+ name == o.name &&
83
+ role == o.role
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [id, name, role].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ Phrase.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+ end
212
+ end
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
 
3
3
  module Phrase
4
- class JobTemplateUserPreview
4
+ class LocaleUserPreview
5
5
  attr_accessor :id
6
6
 
7
7
  attr_accessor :username
@@ -40,13 +40,13 @@ module Phrase
40
40
  # @param [Hash] attributes Model attributes in the form of hash
41
41
  def initialize(attributes = {})
42
42
  if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateUserPreview` initialize method"
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::LocaleUserPreview` initialize method"
44
44
  end
45
45
 
46
46
  # check to see if the attribute exists and convert string to symbol for hash key
47
47
  attributes = attributes.each_with_object({}) { |(k, v), h|
48
48
  if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateUserPreview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::LocaleUserPreview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
50
  end
51
51
  h[k.to_sym] = v
52
52
  }
@@ -34,7 +34,7 @@ module Phrase
34
34
  :'created_at' => :'DateTime',
35
35
  :'updated_at' => :'DateTime',
36
36
  :'notifications_count' => :'Integer',
37
- :'latest_notification' => :'Object'
37
+ :'latest_notification' => :'Notification'
38
38
  }
39
39
  end
40
40