phrase 2.16.0 → 2.18.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +1 -0
  4. data/README.md +13 -3
  5. data/docs/CommentRepliesApi.md +3 -1
  6. data/docs/CommentsApi.md +3 -1
  7. data/docs/CommentsListParameters.md +3 -1
  8. data/docs/DistributionCreateParameters.md +1 -1
  9. data/docs/FigmaAttachment.md +23 -0
  10. data/docs/FigmaAttachmentCreateParameters.md +19 -0
  11. data/docs/FigmaAttachmentUpdateParameters.md +19 -0
  12. data/docs/FigmaAttachmentsApi.md +341 -0
  13. data/docs/JobCommentsApi.md +3 -1
  14. data/docs/KeysFigmaAttachmentsApi.md +142 -0
  15. data/docs/RepliesListParameters.md +3 -1
  16. data/lib/phrase/api/comment_replies_api.rb +3 -0
  17. data/lib/phrase/api/comments_api.rb +3 -0
  18. data/lib/phrase/api/figma_attachments_api.rb +393 -0
  19. data/lib/phrase/api/job_comments_api.rb +3 -0
  20. data/lib/phrase/api/keys_figma_attachments_api.rb +168 -0
  21. data/lib/phrase/models/comments_list_parameters.rb +14 -4
  22. data/lib/phrase/models/distribution_create_parameters.rb +1 -1
  23. data/lib/phrase/models/figma_attachment.rb +221 -0
  24. data/lib/phrase/models/figma_attachment_create_parameters.rb +205 -0
  25. data/lib/phrase/models/figma_attachment_update_parameters.rb +205 -0
  26. data/lib/phrase/models/replies_list_parameters.rb +14 -4
  27. data/lib/phrase/version.rb +1 -1
  28. data/lib/phrase.rb +5 -0
  29. data/spec/api/comment_replies_api_spec.rb +1 -0
  30. data/spec/api/comments_api_spec.rb +1 -0
  31. data/spec/api/figma_attachments_api_spec.rb +100 -0
  32. data/spec/api/job_comments_api_spec.rb +1 -0
  33. data/spec/api/keys_figma_attachments_api_spec.rb +55 -0
  34. data/spec/api/locales_api_spec.rb +108 -4
  35. data/spec/api/uploads_api_spec.rb +15 -1
  36. data/spec/models/comments_list_parameters_spec.rb +6 -0
  37. data/spec/models/figma_attachment_create_parameters_spec.rb +35 -0
  38. data/spec/models/figma_attachment_spec.rb +47 -0
  39. data/spec/models/figma_attachment_update_parameters_spec.rb +35 -0
  40. data/spec/models/replies_list_parameters_spec.rb +6 -0
  41. data/spec/spec_helper.rb +1 -0
  42. metadata +236 -216
@@ -0,0 +1,205 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class FigmaAttachmentUpdateParameters
5
+ # specify the branch to use
6
+ attr_accessor :branch
7
+
8
+ # Figma file url
9
+ attr_accessor :url
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'branch' => :'branch',
15
+ :'url' => :'url'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.openapi_types
21
+ {
22
+ :'branch' => :'String',
23
+ :'url' => :'String'
24
+ }
25
+ end
26
+
27
+ # List of attributes with nullable: true
28
+ def self.openapi_nullable
29
+ Set.new([
30
+ ])
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ if (!attributes.is_a?(Hash))
37
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::FigmaAttachmentUpdateParameters` initialize method"
38
+ end
39
+
40
+ # check to see if the attribute exists and convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h|
42
+ if (!self.class.attribute_map.key?(k.to_sym))
43
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::FigmaAttachmentUpdateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
44
+ end
45
+ h[k.to_sym] = v
46
+ }
47
+
48
+ if attributes.key?(:'branch')
49
+ self.branch = attributes[:'branch']
50
+ end
51
+
52
+ if attributes.key?(:'url')
53
+ self.url = attributes[:'url']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ branch == o.branch &&
76
+ url == o.url
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Integer] Hash code
87
+ def hash
88
+ [branch, url].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def self.build_from_hash(attributes)
95
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.openapi_types.each_pair do |key, type|
104
+ if type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
109
+ end
110
+ elsif !attributes[self.class.attribute_map[key]].nil?
111
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
112
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param string type Data type
120
+ # @param string value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :Boolean
135
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when :Object
141
+ # generic object (usually a Hash), return directly
142
+ value
143
+ when /\AArray<(?<inner_type>.+)>\z/
144
+ inner_type = Regexp.last_match[:inner_type]
145
+ value.map { |v| _deserialize(inner_type, v) }
146
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
+ k_type = Regexp.last_match[:k_type]
148
+ v_type = Regexp.last_match[:v_type]
149
+ {}.tap do |hash|
150
+ value.each do |k, v|
151
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
+ end
153
+ end
154
+ else # model
155
+ Phrase.const_get(type).build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ if value.nil?
178
+ is_nullable = self.class.openapi_nullable.include?(attr)
179
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
180
+ end
181
+
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+ end
205
+ end
@@ -11,12 +11,16 @@ module Phrase
11
11
  # Specify filters to find comments by
12
12
  attr_accessor :filters
13
13
 
14
+ # Specify ordering of comments
15
+ attr_accessor :order
16
+
14
17
  # Attribute mapping from ruby-style variable name to JSON key.
15
18
  def self.attribute_map
16
19
  {
17
20
  :'branch' => :'branch',
18
21
  :'query' => :'query',
19
- :'filters' => :'filters'
22
+ :'filters' => :'filters',
23
+ :'order' => :'order'
20
24
  }
21
25
  end
22
26
 
@@ -25,7 +29,8 @@ module Phrase
25
29
  {
26
30
  :'branch' => :'String',
27
31
  :'query' => :'String',
28
- :'filters' => :'Array<String>'
32
+ :'filters' => :'Array<String>',
33
+ :'order' => :'String'
29
34
  }
30
35
  end
31
36
 
@@ -63,6 +68,10 @@ module Phrase
63
68
  self.filters = value
64
69
  end
65
70
  end
71
+
72
+ if attributes.key?(:'order')
73
+ self.order = attributes[:'order']
74
+ end
66
75
  end
67
76
 
68
77
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -85,7 +94,8 @@ module Phrase
85
94
  self.class == o.class &&
86
95
  branch == o.branch &&
87
96
  query == o.query &&
88
- filters == o.filters
97
+ filters == o.filters &&
98
+ order == o.order
89
99
  end
90
100
 
91
101
  # @see the `==` method
@@ -97,7 +107,7 @@ module Phrase
97
107
  # Calculates hash code according to all attributes.
98
108
  # @return [Integer] Hash code
99
109
  def hash
100
- [branch, query, filters].hash
110
+ [branch, query, filters, order].hash
101
111
  end
102
112
 
103
113
  # Builds the object from hash
@@ -1,3 +1,3 @@
1
1
  module Phrase
2
- VERSION = '2.16.0'
2
+ VERSION = '2.18.0'
3
3
  end
data/lib/phrase.rb CHANGED
@@ -43,6 +43,9 @@ require 'phrase/models/distribution_create_parameters'
43
43
  require 'phrase/models/distribution_preview'
44
44
  require 'phrase/models/distribution_update_parameters'
45
45
  require 'phrase/models/document'
46
+ require 'phrase/models/figma_attachment'
47
+ require 'phrase/models/figma_attachment_create_parameters'
48
+ require 'phrase/models/figma_attachment_update_parameters'
46
49
  require 'phrase/models/format'
47
50
  require 'phrase/models/github_sync_export_parameters'
48
51
  require 'phrase/models/github_sync_import_parameters'
@@ -226,6 +229,7 @@ require 'phrase/api/comment_replies_api'
226
229
  require 'phrase/api/comments_api'
227
230
  require 'phrase/api/distributions_api'
228
231
  require 'phrase/api/documents_api'
232
+ require 'phrase/api/figma_attachments_api'
229
233
  require 'phrase/api/formats_api'
230
234
  require 'phrase/api/git_hub_sync_api'
231
235
  require 'phrase/api/git_lab_sync_api'
@@ -240,6 +244,7 @@ require 'phrase/api/job_template_locales_api'
240
244
  require 'phrase/api/job_templates_api'
241
245
  require 'phrase/api/jobs_api'
242
246
  require 'phrase/api/keys_api'
247
+ require 'phrase/api/keys_figma_attachments_api'
243
248
  require 'phrase/api/locales_api'
244
249
  require 'phrase/api/members_api'
245
250
  require 'phrase/api/notification_groups_api'
@@ -34,6 +34,7 @@ describe 'CommentRepliesApi' do
34
34
  # @option opts [String] :branch specify the branch to use
35
35
  # @option opts [String] :query Search query for comment messages
36
36
  # @option opts [Array<String>] :filters Specify the filter for the comments
37
+ # @option opts [String] :order Order direction. Can be one of: asc, desc.
37
38
  # @return [Array<Comment>]
38
39
  describe 'replies_list test' do
39
40
  it 'should work' do
@@ -147,6 +147,7 @@ describe 'CommentsApi' do
147
147
  # @option opts [String] :query Search query for comment messages
148
148
  # @option opts [Array<String>] :locale_ids Search comments by their assigned locales
149
149
  # @option opts [Array<String>] :filters Specify the filter for the comments
150
+ # @option opts [String] :order Order direction. Can be one of: asc, desc.
150
151
  # @return [Array<Comment>]
151
152
  describe 'comments_list test' do
152
153
  it 'should work' do
@@ -0,0 +1,100 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ # Unit tests for Phrase::FigmaAttachmentsApi
5
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
6
+ # Please update as you see appropriate
7
+ describe 'FigmaAttachmentsApi' do
8
+ before do
9
+ # run before each test
10
+ @api_instance = Phrase::FigmaAttachmentsApi.new
11
+ end
12
+
13
+ after do
14
+ # run after each test
15
+ end
16
+
17
+ describe 'test an instance of FigmaAttachmentsApi' do
18
+ it 'should create an instance of FigmaAttachmentsApi' do
19
+ expect(@api_instance).to be_instance_of(Phrase::FigmaAttachmentsApi)
20
+ end
21
+ end
22
+
23
+ # unit tests for figma_attachment_create
24
+ # Create a Figma attachment
25
+ # Create a new Figma attachment.
26
+ # @param project_id Project ID
27
+ # @param figma_attachment_create_parameters
28
+ # @param [Hash] opts the optional parameters
29
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
30
+ # @option opts [String] :branch specify the branch to use
31
+ # @return [FigmaAttachment]
32
+ describe 'figma_attachment_create test' do
33
+ it 'should work' do
34
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
35
+ end
36
+ end
37
+
38
+ # unit tests for figma_attachment_delete
39
+ # Delete a Figma attachment
40
+ # Delete an existing Figma attachment.
41
+ # @param project_id Project ID
42
+ # @param id ID
43
+ # @param [Hash] opts the optional parameters
44
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
45
+ # @option opts [String] :branch specify the branch to use
46
+ # @return [nil]
47
+ describe 'figma_attachment_delete test' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ # unit tests for figma_attachment_show
54
+ # Get a single Figma attachment
55
+ # Get details on a single Figma attachment for a given project.
56
+ # @param project_id Project ID
57
+ # @param id ID
58
+ # @param [Hash] opts the optional parameters
59
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
60
+ # @option opts [String] :branch specify the branch to use
61
+ # @return [FigmaAttachment]
62
+ describe 'figma_attachment_show test' do
63
+ it 'should work' do
64
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
65
+ end
66
+ end
67
+
68
+ # unit tests for figma_attachment_update
69
+ # Update a Figma attachment
70
+ # Update an existing Figma attachment.
71
+ # @param project_id Project ID
72
+ # @param id ID
73
+ # @param figma_attachment_update_parameters
74
+ # @param [Hash] opts the optional parameters
75
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
76
+ # @option opts [String] :branch specify the branch to use
77
+ # @return [FigmaAttachment]
78
+ describe 'figma_attachment_update test' do
79
+ it 'should work' do
80
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
81
+ end
82
+ end
83
+
84
+ # unit tests for figma_attachments_list
85
+ # List Figma attachments
86
+ # List all Figma attachments for the given project
87
+ # @param project_id Project ID
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
90
+ # @option opts [Integer] :page Page number
91
+ # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
92
+ # @option opts [String] :branch specify the branch to use
93
+ # @return [Array<FigmaAttachment>]
94
+ describe 'figma_attachments_list test' do
95
+ it 'should work' do
96
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
97
+ end
98
+ end
99
+
100
+ end
@@ -91,6 +91,7 @@ describe 'JobCommentsApi' do
91
91
  # @param [Hash] opts the optional parameters
92
92
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
93
93
  # @option opts [String] :branch specify the branch to use
94
+ # @option opts [String] :order Order direction. Can be one of: asc, desc.
94
95
  # @return [Array<JobComment>]
95
96
  describe 'job_comments_list test' do
96
97
  it 'should work' do
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ # Unit tests for Phrase::KeysFigmaAttachmentsApi
5
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
6
+ # Please update as you see appropriate
7
+ describe 'KeysFigmaAttachmentsApi' do
8
+ before do
9
+ # run before each test
10
+ @api_instance = Phrase::KeysFigmaAttachmentsApi.new
11
+ end
12
+
13
+ after do
14
+ # run after each test
15
+ end
16
+
17
+ describe 'test an instance of KeysFigmaAttachmentsApi' do
18
+ it 'should create an instance of KeysFigmaAttachmentsApi' do
19
+ expect(@api_instance).to be_instance_of(Phrase::KeysFigmaAttachmentsApi)
20
+ end
21
+ end
22
+
23
+ # unit tests for figma_attachment_attach_to_key
24
+ # Attach the Figma attachment to a key
25
+ # Attach the Figma attachment to a key
26
+ # @param project_id Project ID
27
+ # @param figma_attachment_id Figma attachment ID
28
+ # @param id ID
29
+ # @param [Hash] opts the optional parameters
30
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
31
+ # @option opts [String] :branch specify the branch to use
32
+ # @return [nil]
33
+ describe 'figma_attachment_attach_to_key test' do
34
+ it 'should work' do
35
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
36
+ end
37
+ end
38
+
39
+ # unit tests for figma_attachment_detach_from_key
40
+ # Detach the Figma attachment from a key
41
+ # Detach the Figma attachment from a key
42
+ # @param project_id Project ID
43
+ # @param figma_attachment_id Figma attachment ID
44
+ # @param id ID
45
+ # @param [Hash] opts the optional parameters
46
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
47
+ # @option opts [String] :branch specify the branch to use
48
+ # @return [nil]
49
+ describe 'figma_attachment_detach_from_key test' do
50
+ it 'should work' do
51
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ end
53
+ end
54
+
55
+ end
@@ -39,7 +39,7 @@ describe 'LocalesApi' do
39
39
  # Create a locale
40
40
  # Create a new locale.
41
41
  # @param project_id Project ID
42
- # @param locale_create_parameters
42
+ # @param locale_create_parameters
43
43
  # @param [Hash] opts the optional parameters
44
44
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
45
45
  # @return [LocaleDetails]
@@ -91,8 +91,28 @@ describe 'LocalesApi' do
91
91
  # @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a &lt;code&gt;tag&lt;/code&gt; parameter indicating a specific job.
92
92
  # @return [File]
93
93
  describe 'locale_download test' do
94
+ let(:project_id) { 'project_id_example' }
95
+ let(:id) { 'id_example' }
96
+ let(:opts) { {
97
+ branch: 'branch_example',
98
+ format_options: {foo: 'bar'},
99
+ } }
100
+
101
+ before do
102
+ stub_request(:any, /.*phrase.com/)
103
+ .to_return(status: 200, body: "foo", headers: {
104
+ 'Content-Type' => 'application/octet-stream',
105
+ 'Content-Disposition' => 'attachment; filename="test.txt"',
106
+ })
107
+ end
108
+
94
109
  it 'should work' do
95
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
110
+ locale = @api_instance.locale_download(project_id, id, opts)
111
+ expect(a_request(:get, "https://api.phrase.com/v2/projects/project_id_example/locales/id_example/download").with(query: {branch: "branch_example", format_options: {foo: "bar"}})).
112
+ to have_been_made
113
+
114
+ expect(locale).to be_instance_of(Phrase::Response)
115
+ expect(File.read(locale.data)).to eq("foo")
96
116
  end
97
117
  end
98
118
 
@@ -116,7 +136,7 @@ describe 'LocalesApi' do
116
136
  # Update an existing locale.
117
137
  # @param project_id Project ID
118
138
  # @param id Locale ID or locale name
119
- # @param locale_update_parameters
139
+ # @param locale_update_parameters
120
140
  # @param [Hash] opts the optional parameters
121
141
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
122
142
  # @return [LocaleDetails]
@@ -138,8 +158,92 @@ describe 'LocalesApi' do
138
158
  # @option opts [String] :branch specify the branch to use
139
159
  # @return [Array<Locale>]
140
160
  describe 'locales_list test' do
161
+ let(:project_id) { 'project_id_example' }
162
+ let(:opts) { {
163
+ branch: 'branch_example',
164
+ } }
165
+ let(:response_body) {
166
+ <<-EOF
167
+ [
168
+ {
169
+ "id": "ae0ce77b64dbf7e8315b5da8ecbb42c0",
170
+ "name": "de-DE",
171
+ "code": "de-DE",
172
+ "default": false,
173
+ "main": false,
174
+ "rtl": false,
175
+ "plural_forms": [
176
+ "zero",
177
+ "one",
178
+ "other"
179
+ ],
180
+ "created_at": "2022-10-27T11:03:39Z",
181
+ "updated_at": "2023-10-05T09:49:28Z",
182
+ "source_locale": null,
183
+ "fallback_locale": null
184
+ },
185
+ {
186
+ "id": "95060c3b178252e0c5d1936493e93108",
187
+ "name": "en-US",
188
+ "code": "en-US",
189
+ "default": true,
190
+ "main": false,
191
+ "rtl": false,
192
+ "plural_forms": [
193
+ "zero",
194
+ "one",
195
+ "other"
196
+ ],
197
+ "created_at": "2022-10-27T11:03:39Z",
198
+ "updated_at": "2023-10-05T09:50:20Z",
199
+ "source_locale": null,
200
+ "fallback_locale": null
201
+ },
202
+ {
203
+ "id": "97b4b258d9000f256a97276561294b5b",
204
+ "name": "sh",
205
+ "code": "sr-Latn-RS",
206
+ "default": false,
207
+ "main": false,
208
+ "rtl": false,
209
+ "plural_forms": [
210
+ "zero",
211
+ "one",
212
+ "few",
213
+ "other"
214
+ ],
215
+ "created_at": "2022-10-27T11:03:39Z",
216
+ "updated_at": "2023-05-10T08:22:18Z",
217
+ "source_locale": null,
218
+ "fallback_locale": null
219
+ }
220
+ ]
221
+ EOF
222
+ }
223
+
224
+ before do
225
+ stub_request(:any, /.*phrase.com/)
226
+ .to_return(status: 200, body: response_body, headers: {
227
+ 'Content-Type' => 'application/json'
228
+ })
229
+ end
230
+
141
231
  it 'should work' do
142
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
232
+ locales = @api_instance.locales_list(project_id, opts)
233
+ expect(a_request(:get, "https://api.phrase.com/v2/projects/project_id_example/locales").with(query: {branch: "branch_example"})).
234
+ to have_been_made
235
+
236
+ expect(locales).to be_instance_of(Phrase::Response)
237
+ expect(locales.data).to be_instance_of(Array)
238
+ expect(locales.data.length).to eq(3)
239
+ expect(locales.data[0]).to be_instance_of(Phrase::Locale)
240
+ expect(locales.data[0].id).to eq("ae0ce77b64dbf7e8315b5da8ecbb42c0")
241
+ expect(locales.data[0].name).to eq("de-DE")
242
+ expect(locales.data[0].code).to eq("de-DE")
243
+ expect(locales.data[0].default).to eq(false)
244
+ expect(locales.data[0].plural_forms).to eq(["zero", "one", "other"])
245
+ expect(locales.data[0].created_at).to eq(DateTime.parse("2022-10-27T11:03:39Z"))
246
+ expect(locales.data[0].updated_at).to eq(DateTime.parse("2023-10-05T09:49:28Z"))
143
247
  end
144
248
  end
145
249
 
@@ -44,8 +44,22 @@ describe 'UploadsApi' do
44
44
  # @option opts [Boolean] :tag_only_affected_keys Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is &#x60;false&#x60;
45
45
  # @return [Upload]
46
46
  describe 'upload_create test' do
47
+ let(:response_body) { { data: {} }.to_json }
48
+ before do
49
+ stub_request(:any, /.*phrase.com/)
50
+ .to_return(status: 200, body: response_body, headers: {
51
+ 'Content-Type' => 'application/json'
52
+ })
53
+ end
54
+
47
55
  it 'should work' do
48
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ @api_instance.upload_create('project_id', file: File.new('Gemfile'))
57
+
58
+ expect(a_request(:post, 'https://api.phrase.com/v2/projects/project_id/uploads')
59
+ .with { |req|
60
+ expect(req.headers['Content-Type']).to eq('multipart/form-data')
61
+ # expect(req.body).to include('Gemfile')
62
+ }).to have_been_made
49
63
  end
50
64
  end
51
65
 
@@ -44,4 +44,10 @@ describe 'CommentsListParameters' do
44
44
  end
45
45
  end
46
46
 
47
+ describe 'test attribute "order"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
47
53
  end