ruby-lokalise-api 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -2
  3. data/README.md +172 -10
  4. data/lib/ruby-lokalise-api.rb +2 -0
  5. data/lib/ruby-lokalise-api/client.rb +18 -0
  6. data/lib/ruby-lokalise-api/collections/base.rb +11 -10
  7. data/lib/ruby-lokalise-api/collections/contributor.rb +1 -3
  8. data/lib/ruby-lokalise-api/collections/file.rb +1 -3
  9. data/lib/ruby-lokalise-api/collections/key.rb +8 -3
  10. data/lib/ruby-lokalise-api/collections/key_comment.rb +2 -3
  11. data/lib/ruby-lokalise-api/collections/project.rb +1 -3
  12. data/lib/ruby-lokalise-api/collections/project_comment.rb +1 -3
  13. data/lib/ruby-lokalise-api/collections/project_language.rb +1 -3
  14. data/lib/ruby-lokalise-api/collections/screenshot.rb +1 -3
  15. data/lib/ruby-lokalise-api/collections/snapshot.rb +1 -3
  16. data/lib/ruby-lokalise-api/collections/system_language.rb +1 -3
  17. data/lib/ruby-lokalise-api/collections/task.rb +1 -3
  18. data/lib/ruby-lokalise-api/collections/team.rb +1 -3
  19. data/lib/ruby-lokalise-api/collections/team_user.rb +1 -3
  20. data/lib/ruby-lokalise-api/collections/translation.rb +1 -3
  21. data/lib/ruby-lokalise-api/error.rb +2 -0
  22. data/lib/ruby-lokalise-api/request.rb +11 -3
  23. data/lib/ruby-lokalise-api/resources/base.rb +51 -41
  24. data/lib/ruby-lokalise-api/resources/contributor.rb +6 -4
  25. data/lib/ruby-lokalise-api/resources/file.rb +7 -12
  26. data/lib/ruby-lokalise-api/resources/key.rb +5 -4
  27. data/lib/ruby-lokalise-api/resources/key_comment.rb +6 -4
  28. data/lib/ruby-lokalise-api/resources/project.rb +10 -7
  29. data/lib/ruby-lokalise-api/resources/project_language.rb +5 -4
  30. data/lib/ruby-lokalise-api/resources/screenshot.rb +5 -4
  31. data/lib/ruby-lokalise-api/resources/snapshot.rb +10 -5
  32. data/lib/ruby-lokalise-api/resources/task.rb +5 -4
  33. data/lib/ruby-lokalise-api/resources/team_user.rb +6 -4
  34. data/lib/ruby-lokalise-api/resources/translation.rb +5 -4
  35. data/lib/ruby-lokalise-api/rest/comments.rb +6 -6
  36. data/lib/ruby-lokalise-api/rest/contributors.rb +6 -6
  37. data/lib/ruby-lokalise-api/rest/files.rb +3 -3
  38. data/lib/ruby-lokalise-api/rest/keys.rb +9 -9
  39. data/lib/ruby-lokalise-api/rest/languages.rb +7 -7
  40. data/lib/ruby-lokalise-api/rest/projects.rb +7 -7
  41. data/lib/ruby-lokalise-api/rest/screenshots.rb +6 -6
  42. data/lib/ruby-lokalise-api/rest/snapshots.rb +5 -5
  43. data/lib/ruby-lokalise-api/rest/tasks.rb +6 -6
  44. data/lib/ruby-lokalise-api/rest/team_users.rb +5 -5
  45. data/lib/ruby-lokalise-api/rest/teams.rb +1 -1
  46. data/lib/ruby-lokalise-api/rest/translations.rb +3 -3
  47. data/lib/ruby-lokalise-api/utils/attribute_helpers.rb +19 -5
  48. data/lib/ruby-lokalise-api/utils/endpoint_helpers.rb +12 -0
  49. data/lib/ruby-lokalise-api/utils/string_utils.rb +4 -0
  50. data/lib/ruby-lokalise-api/version.rb +1 -1
  51. data/ruby-lokalise-api.gemspec +1 -0
  52. data/spec/lib/ruby-lokalise-api/rest/comments_spec.rb +22 -5
  53. data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +35 -2
  54. data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +55 -4
  55. data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +31 -2
  56. data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +36 -2
  57. data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +45 -8
  58. data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +25 -2
  59. data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +38 -2
  60. data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +25 -2
  61. data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +17 -3
  62. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5258f1c07fdb9ffa68ab473b4bddf714f42874a049fa6657f1c3791f3cad3f6b
4
- data.tar.gz: '05957d96074c503f46c49fb0a88292e6b5a30248c643d094b5dbabfa51dbb7b3'
3
+ metadata.gz: 3917d088f403329a2daf516f1c7ae13ceb58c4afb598f77c7ce5fe71e8b80361
4
+ data.tar.gz: dd8a1a57656a0826841576c27a0b7d343dbab5b41ff87440f49ec1cc77816df3
5
5
  SHA512:
6
- metadata.gz: 5539b8cf6ab910c93ffe47b1ffd1b47ac4d323c971560d869fdf7dd0531e81b2312bbc45f1d4c6ea3d30af4fd451726bd14333a440bec0d8fb85ffc5c30caa62
7
- data.tar.gz: c02b44af1ca82999d596e278fa65c7831590080f64168ab16b7d9f407e04087fdbe92e4d7177ab41bb56cedde30624277dce8fb2bf22873439c9160372bf83a4
6
+ metadata.gz: cb7a76b7c937254b86cd6f5ec3398fe8623c44712cb465fc313eaedf1539e28d850e6e71d28282a8dc7131901918c06911fe72437e5aa053b98c7f7d6086f297
7
+ data.tar.gz: 22905df5254cd09103f79743cdb19bd6f6b2db8c081ffe528ae00f7f35cc4cafab9b3003cb8c04c6fe5ab11403722e228231c1636262921f531ffe342ada3525
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## 1.1.0
3
+ ## 2.0.0 (14-Dec-18)
4
+
5
+ * Major re-write of internal stuff
6
+ * Introduce method chaining
7
+ * Rename all `#delete` interface methods to `#destroy`
8
+
9
+ ## 1.1.0 (11-Dec-18)
4
10
 
5
11
  * Added methods to work with pagination (`next_page?`, `last_page?`, `prev_page?`, `first_page?`, `next_page`, `prev_page`)
6
12
 
@@ -10,4 +16,4 @@
10
16
 
11
17
  ## 1.0.0 (10-Dec-18)
12
18
 
13
- * Initial release
19
+ * Initial release
data/README.md CHANGED
@@ -75,6 +75,12 @@ To get access to raw data returned by the API, use `#raw_data`:
75
75
  project.raw_data
76
76
  ```
77
77
 
78
+ Models support method chaining, meaning you can fetch a resource, update and delete it in one line:
79
+
80
+ ```ruby
81
+ @client.project('123').update(name: 'New name').destroy
82
+ ```
83
+
78
84
  ### Collections of resources and pagination
79
85
 
80
86
  Fetching (or creating/updating) multiple objects will return a *collection* of objects. To get access to the actual data, use `#collection` method:
@@ -189,7 +195,7 @@ translations.prev_page # => will load the previous page while preserving the `li
189
195
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-comment-delete)
190
196
 
191
197
  ```ruby
192
- @client.delete_comment(project_id, key_id, comment_id) # Input:
198
+ @client.destroy_comment(project_id, key_id, comment_id) # Input:
193
199
  ## project_id (string, required)
194
200
  ## key_id (string, required)
195
201
  ## comment_id (string, required)
@@ -197,6 +203,13 @@ translations.prev_page # => will load the previous page while preserving the `li
197
203
  ## Hash with the project's id and "comment_deleted"=>true
198
204
  ```
199
205
 
206
+ Alternatively:
207
+
208
+ ```ruby
209
+ comment = @client.comment('project_id', 'comment_id')
210
+ comment.destroy
211
+ ```
212
+
200
213
  ### Contributors
201
214
 
202
215
  #### Fetch contributors
@@ -263,18 +276,32 @@ translations.prev_page # => will load the previous page while preserving the `li
263
276
  ## Updated contributor
264
277
  ```
265
278
 
279
+ Alternatively:
280
+
281
+ ```ruby
282
+ contributor = @client.contributor('project_id', 'contributor_id')
283
+ contributor.update(params)
284
+ ```
285
+
266
286
  #### Delete contributor
267
287
 
268
288
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-contributor-delete)
269
289
 
270
290
  ```ruby
271
- @client.delete_contributor(project_id, contributor_id) # Input:
291
+ @client.destroy_contributor(project_id, contributor_id) # Input:
272
292
  ## project_id (string, required)
273
293
  ## contributor_id (string, required)
274
294
  # Output:
275
295
  ## Hash with the project's id and "contributor_deleted"=>true
276
296
  ```
277
297
 
298
+ Alternatively:
299
+
300
+ ```ruby
301
+ contributor = @client.contributor('project_id', 'id')
302
+ contributor.destroy
303
+ ```
304
+
278
305
  ### Files
279
306
 
280
307
  [File attributes](https://lokalise.co/api2docs/ruby/#object-files)
@@ -384,6 +411,13 @@ Exports project files as a `.zip` bundle and makes them available to download (t
384
411
  ## Updated key
385
412
  ```
386
413
 
414
+ Alternatively:
415
+
416
+ ```ruby
417
+ key = @client.key('project_id', 'key_id')
418
+ key.update(params)
419
+ ```
420
+
387
421
  #### Bulk update project keys
388
422
 
389
423
  [Doc](https://lokalise.co/api2docs/ruby/#transition-bulk-update-put)
@@ -403,25 +437,39 @@ Exports project files as a `.zip` bundle and makes them available to download (t
403
437
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-key-delete)
404
438
 
405
439
  ```ruby
406
- @client.delete_key(project_id, key_id) # Input:
440
+ @client.destroy_key(project_id, key_id) # Input:
407
441
  ## project_id (string, required)
408
442
  ## key_id (string, required)
409
443
  # Output:
410
444
  ## Hash with project_id and "key_removed" set to "true"
411
445
  ```
412
446
 
447
+ Alternatively:
448
+
449
+ ```ruby
450
+ key = @client.key('project_id', 'key_id')
451
+ key.destroy
452
+ ```
453
+
413
454
  #### Bulk delete project keys
414
455
 
415
456
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-multiple-keys-delete)
416
457
 
417
458
  ```ruby
418
- @client.delete_keys(project_id, key_ids) # Input:
459
+ @client.destroy_keys(project_id, key_ids) # Input:
419
460
  ## project_id (string, required)
420
461
  ## key_ids (array, required)
421
462
  # Output:
422
463
  ## Hash with project_id and "keys_removed" set to "true"
423
464
  ```
424
465
 
466
+ Alternatively:
467
+
468
+ ```ruby
469
+ keys = @client.keys('project_id')
470
+ keys.destroy_all # => will effectively destroy all keys in the project
471
+ ```
472
+
425
473
  ### Languages
426
474
 
427
475
  [Language attributes](https://lokalise.co/api2docs/ruby/#object-languages)
@@ -495,18 +543,32 @@ Exports project files as a `.zip` bundle and makes them available to download (t
495
543
  ## Updated language
496
544
  ```
497
545
 
546
+ Alternatively:
547
+
548
+ ```ruby
549
+ language = @client.language('project_id', 'lang_id')
550
+ language.update(params)
551
+ ```
552
+
498
553
  #### Delete project language
499
554
 
500
555
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-language-delete)
501
556
 
502
557
  ```ruby
503
- @client.delete_language(project_id, language_id) # Input:
558
+ @client.destroy_language(project_id, language_id) # Input:
504
559
  ## project_id (string, required)
505
560
  ## language_id (string, required)
506
561
  # Output:
507
562
  ## Hash with the project's id and "language_deleted"=>true
508
563
  ```
509
564
 
565
+ Alternatively:
566
+
567
+ ```ruby
568
+ language = @client.language('project_id', 'lang_id')
569
+ language.destroy
570
+ ```
571
+
510
572
  ### Projects
511
573
 
512
574
  [Project attributes](https://lokalise.co/api2docs/php/#object-projects)
@@ -564,6 +626,13 @@ Exports project files as a `.zip` bundle and makes them available to download (t
564
626
  ## An updated project
565
627
  ```
566
628
 
629
+ Alternatively:
630
+
631
+ ```ruby
632
+ project = @client.project('project_id')
633
+ project.update(params)
634
+ ```
635
+
567
636
  #### Empty a project
568
637
 
569
638
  [Doc](https://lokalise.co/api2docs/php/#transition-empty-a-project-put)
@@ -577,17 +646,31 @@ Deletes *all* keys and translations from the project.
577
646
  ## A project containing its id and a `keys_deleted => true` attribute
578
647
  ```
579
648
 
649
+ Alternatively:
650
+
651
+ ```ruby
652
+ project = @client.project('project_id')
653
+ project.empty
654
+ ```
655
+
580
656
  #### Delete a project
581
657
 
582
658
  [Doc](https://lokalise.co/api2docs/php/#transition-delete-a-project-delete)
583
659
 
584
660
  ```ruby
585
- @client.delete_project(project_id) # Input:
661
+ @client.destroy_project(project_id) # Input:
586
662
  ## project_id (string, required)
587
663
  # Output:
588
664
  ## A project containing its id and a `project_deleted => true` attribute
589
665
  ```
590
666
 
667
+ Alternatively:
668
+
669
+ ```ruby
670
+ project = @client.project('project_id')
671
+ project.destroy
672
+ ```
673
+
591
674
  ### Screenshots
592
675
 
593
676
  [Screenshot attributes](https://lokalise.co/api2docs/ruby/#resource-screenshots)
@@ -652,18 +735,32 @@ Deletes *all* keys and translations from the project.
652
735
  ## Updated screenshot
653
736
  ```
654
737
 
738
+ Alternatively:
739
+
740
+ ```ruby
741
+ screenshot = @client.screenshot('project_id', 'screen_id')
742
+ screenshot.update(params)
743
+ ```
744
+
655
745
  #### Delete screenshot
656
746
 
657
747
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-screenshot-delete)
658
748
 
659
749
  ```ruby
660
- @client.delete_screenshot(project_id, screenshot_id) # Input:
750
+ @client.destroy_screenshot(project_id, screenshot_id) # Input:
661
751
  ## project_id (string, required)
662
752
  ## screenshot_id (string, required)
663
753
  # Output:
664
754
  ## Hash with the project id and "screenshot_deleted" set to "true"
665
755
  ```
666
756
 
757
+ Alternatively:
758
+
759
+ ```ruby
760
+ screenshot = @client.screenshot('project_id', 'screen_id')
761
+ screenshot.destroy
762
+ ```
763
+
667
764
  ### Snapshots
668
765
 
669
766
  [Snapshot attributes](https://lokalise.co/api2docs/ruby/#object-snapshots)
@@ -707,18 +804,32 @@ Deletes *all* keys and translations from the project.
707
804
  ## Information about the restored project from the specified snapshot
708
805
  ```
709
806
 
807
+ Alternatively:
808
+
809
+ ```ruby
810
+ snapshot = @client.snapshots('project_id').first # you can't fetch a single snapshot
811
+ snapshot.restore
812
+ ```
813
+
710
814
  #### Delete snapshot
711
815
 
712
816
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-snapshot-delete)
713
817
 
714
818
  ```ruby
715
- @client.delete_snapshot(project_id, snapshot_id) # Input:
819
+ @client.destroy_snapshot(project_id, snapshot_id) # Input:
716
820
  ## project_id (string, required)
717
821
  ## snapshot_id (string, required)
718
822
  # Output:
719
823
  ## Hash with the project id and "snapshot_deleted" set to "true"
720
824
  ```
721
825
 
826
+ Alternatively:
827
+
828
+ ```ruby
829
+ snapshot = @client.snapshots('project_id').first # you can't fetch a single snapshot
830
+ snapshot.destroy
831
+ ```
832
+
722
833
  ### Tasks
723
834
 
724
835
  [Task attributes](https://lokalise.co/api2docs/ruby/#resource-tasks)
@@ -773,7 +884,29 @@ Deletes *all* keys and translations from the project.
773
884
  [Doc](https://lokalise.co/api2docs/ruby/#transition-update-a-task-put)
774
885
 
775
886
  ```ruby
776
- @client.delete_task(project_id, task_id) # Input:
887
+ @client.update_task(project_id, task_id, params = {}) # Input:
888
+ ## project_id (string, required)
889
+ ## task_id (string or integer, required)
890
+ ## params (hash)
891
+ ### Find supported params at https://lokalise.co/api2docs/ruby/#transition-update-a-task-put
892
+ # Output:
893
+ ## An updated task
894
+
895
+ ```
896
+
897
+ Alternatively:
898
+
899
+ ```ruby
900
+ task = @client.task('project_id', 'task_id')
901
+ task.update(params)
902
+ ```
903
+
904
+ #### Delete task
905
+
906
+ [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-task-delete)
907
+
908
+ ```ruby
909
+ @client.destroy_task(project_id, task_id) # Input:
777
910
  ## project_id (string, required)
778
911
  ## task_id (string, required)
779
912
  # Output:
@@ -781,6 +914,13 @@ Deletes *all* keys and translations from the project.
781
914
 
782
915
  ```
783
916
 
917
+ Alternatively:
918
+
919
+ ```ruby
920
+ task = @client.task('project_id', 'task_id')
921
+ task.destroy
922
+ ```
923
+
784
924
  ### Teams
785
925
 
786
926
  #### Fetch teams
@@ -838,18 +978,32 @@ Deletes *all* keys and translations from the project.
838
978
  ## Updated team user
839
979
  ```
840
980
 
981
+ Alternatively:
982
+
983
+ ```ruby
984
+ user = @client.team_user('team_id', 'user_id')
985
+ user.update(params)
986
+ ```
987
+
841
988
  #### Delete team user
842
989
 
843
990
  [Doc](https://lokalise.co/api2docs/ruby/#transition-delete-a-team-user-delete)
844
991
 
845
992
  ```ruby
846
- @client.delete_team_user(team_id, user_id) # Input:
993
+ @client.destroy_team_user(team_id, user_id) # Input:
847
994
  ## team_id (string, required)
848
995
  ## user_id (string, required)
849
996
  # Output:
850
997
  ## Hash with "team_id" and "team_user_deleted" set to "true"
851
998
  ```
852
999
 
1000
+ Alternatively:
1001
+
1002
+ ```ruby
1003
+ user = @client.team_user('team_id', 'user_id')
1004
+ user.destroy
1005
+ ```
1006
+
853
1007
  ### Translations
854
1008
 
855
1009
  [Translation attributes](https://lokalise.co/api2docs/ruby/#resource-translations)
@@ -898,6 +1052,13 @@ Deletes *all* keys and translations from the project.
898
1052
  ## Updated translation
899
1053
  ```
900
1054
 
1055
+ Alternatively:
1056
+
1057
+ ```ruby
1058
+ translation = @client.translation('project_id', 'translation_id')
1059
+ translation.update(params)
1060
+ ```
1061
+
901
1062
  ## Additional Info
902
1063
 
903
1064
  ### Error handling
@@ -910,6 +1071,7 @@ The gem may raise the following custom exceptions:
910
1071
  * `Lokalise::Error::Unauthorized` (`401`) - token is missing or incorrect
911
1072
  * `Lokalise::Error::Forbidden` (`403`) - authenticated user does not have sufficient rights to perform the desired action
912
1073
  * `Lokalise::Error::NotFound` (`404`) - the provided endpoint (resource) cannot be found
1074
+ * `Lokalise::Error::MethodNowAllowed` (`405`) - HTTP request with the provided verb is not supported by the endpoint
913
1075
  * `Lokalise::Error::NotAcceptable` (`406`) - posted resource is malformed
914
1076
  * `Lokalise::Error::Conflict` (`409`) - request conflicts with another request
915
1077
  * `Lokalise::Error::Locked` (`423`) - your token is used simultaneously in multiple requests
@@ -1,6 +1,7 @@
1
1
  require 'faraday'
2
2
  require 'multi_json'
3
3
  require 'yaml'
4
+ require 'addressable'
4
5
 
5
6
  require 'ruby-lokalise-api/version'
6
7
  require 'ruby-lokalise-api/connection'
@@ -8,6 +9,7 @@ require 'ruby-lokalise-api/request'
8
9
  require 'ruby-lokalise-api/error'
9
10
  require 'ruby-lokalise-api/utils/string_utils'
10
11
  require 'ruby-lokalise-api/utils/attribute_helpers'
12
+ require 'ruby-lokalise-api/utils/endpoint_helpers'
11
13
 
12
14
  require 'ruby-lokalise-api/resources/base'
13
15
  require 'ruby-lokalise-api/resources/project'
@@ -18,5 +18,23 @@ module Lokalise
18
18
  def initialize(token)
19
19
  @token = token
20
20
  end
21
+
22
+ def construct_request(klass, method, endpoint_ids, params = {}, object_key = nil)
23
+ path = klass.endpoint(*endpoint_ids)
24
+ klass.send method, self, path, format_params(params, object_key)
25
+ end
26
+
27
+ # Converts `params` to hash with arrays under the `object_key` key.
28
+ # Used in bulk operations
29
+ #
30
+ # @return [Hash]
31
+ def format_params(params, object_key)
32
+ return params unless object_key
33
+
34
+ params = [params] unless params.is_a?(Array)
35
+ Hash[object_key, params]
36
+ end
37
+
38
+ alias c_r construct_request
21
39
  end
22
40
  end
@@ -4,17 +4,17 @@ module Lokalise
4
4
  extend Lokalise::Request
5
5
  extend Lokalise::Utils::AttributeHelpers
6
6
  include Lokalise::Utils::AttributeHelpers
7
+ extend Lokalise::Utils::EndpointHelpers
7
8
 
8
9
  attr_reader :total_pages, :total_results, :results_per_page, :current_page, :collection,
9
- :project_id, :team_id, :request_params, :client, :ids
10
+ :project_id, :team_id, :request_params, :client, :path
10
11
 
11
12
  # Initializes a new collection based on the response
12
13
  #
13
14
  # @param response [Hash]
14
15
  # @param params [Hash]
15
- # @param ids [Array, Integer, String]
16
16
  # @return [Lokalise::Collections::Base]
17
- def initialize(response, params = {}, *ids)
17
+ def initialize(response, params = {})
18
18
  produce_collection_for response
19
19
  populate_pagination_data_for response
20
20
  # Project and team id may not be present in some cases
@@ -22,14 +22,14 @@ module Lokalise
22
22
  @team_id = response['content']['team_id']
23
23
  @request_params = params
24
24
  @client = response['client']
25
- @ids = ids
25
+ @path = response['path']
26
26
  end
27
27
 
28
28
  class << self
29
29
  # Performs a batch query fetching multiple records
30
- def all(client, params = {}, *ids)
31
- new get(endpoint(*ids), client, params),
32
- params, *ids
30
+ def all(client, path, params = {})
31
+ new get(path, client, params),
32
+ params
33
33
  end
34
34
  end
35
35
 
@@ -76,8 +76,8 @@ module Lokalise
76
76
 
77
77
  def fetch_page(page_num)
78
78
  self.class.all @client,
79
- @request_params.merge(page: page_num),
80
- *@ids
79
+ @path,
80
+ @request_params.merge(page: page_num)
81
81
  end
82
82
 
83
83
  # Dynamically produces collection of resources based on the given response
@@ -90,7 +90,8 @@ module Lokalise
90
90
  # We also preserve the `client` to be able to chain API methods later
91
91
  @collection = response['content'][data_key_plural].collect do |raw_model|
92
92
  Module.const_get("Lokalise::Resources::#{model_class}").new 'content' => raw_model,
93
- 'client' => response['client']
93
+ 'client' => response['client'],
94
+ 'base_path' => response['path']
94
95
  end
95
96
  end
96
97
  end