ruby-lokalise-api 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +2 -0
  4. data/README.md +1 -0
  5. data/Rakefile +6 -1
  6. data/lib/ruby-lokalise-api.rb +2 -0
  7. data/lib/ruby-lokalise-api/client.rb +2 -0
  8. data/lib/ruby-lokalise-api/collections/base.rb +2 -0
  9. data/lib/ruby-lokalise-api/collections/branch.rb +3 -1
  10. data/lib/ruby-lokalise-api/collections/contributor.rb +2 -0
  11. data/lib/ruby-lokalise-api/collections/custom_translation_status.rb +3 -1
  12. data/lib/ruby-lokalise-api/collections/file.rb +2 -0
  13. data/lib/ruby-lokalise-api/collections/key.rb +2 -0
  14. data/lib/ruby-lokalise-api/collections/key_comment.rb +2 -0
  15. data/lib/ruby-lokalise-api/collections/order.rb +2 -0
  16. data/lib/ruby-lokalise-api/collections/payment_card.rb +2 -0
  17. data/lib/ruby-lokalise-api/collections/project.rb +2 -0
  18. data/lib/ruby-lokalise-api/collections/project_comment.rb +2 -0
  19. data/lib/ruby-lokalise-api/collections/project_language.rb +2 -0
  20. data/lib/ruby-lokalise-api/collections/screenshot.rb +2 -0
  21. data/lib/ruby-lokalise-api/collections/snapshot.rb +2 -0
  22. data/lib/ruby-lokalise-api/collections/system_language.rb +2 -0
  23. data/lib/ruby-lokalise-api/collections/task.rb +2 -0
  24. data/lib/ruby-lokalise-api/collections/team.rb +2 -0
  25. data/lib/ruby-lokalise-api/collections/team_user.rb +2 -0
  26. data/lib/ruby-lokalise-api/collections/team_user_group.rb +3 -1
  27. data/lib/ruby-lokalise-api/collections/translation.rb +2 -0
  28. data/lib/ruby-lokalise-api/collections/translation_provider.rb +2 -0
  29. data/lib/ruby-lokalise-api/collections/webhook.rb +2 -0
  30. data/lib/ruby-lokalise-api/connection.rb +3 -1
  31. data/lib/ruby-lokalise-api/error.rb +2 -0
  32. data/lib/ruby-lokalise-api/json_handler.rb +4 -0
  33. data/lib/ruby-lokalise-api/request.rb +2 -0
  34. data/lib/ruby-lokalise-api/resources/base.rb +2 -0
  35. data/lib/ruby-lokalise-api/resources/branch.rb +2 -0
  36. data/lib/ruby-lokalise-api/resources/contributor.rb +3 -1
  37. data/lib/ruby-lokalise-api/resources/custom_translation_status.rb +3 -1
  38. data/lib/ruby-lokalise-api/resources/file.rb +2 -0
  39. data/lib/ruby-lokalise-api/resources/key.rb +2 -0
  40. data/lib/ruby-lokalise-api/resources/key_comment.rb +4 -2
  41. data/lib/ruby-lokalise-api/resources/order.rb +2 -0
  42. data/lib/ruby-lokalise-api/resources/payment_card.rb +2 -0
  43. data/lib/ruby-lokalise-api/resources/project.rb +2 -0
  44. data/lib/ruby-lokalise-api/resources/project_comment.rb +3 -1
  45. data/lib/ruby-lokalise-api/resources/project_language.rb +4 -2
  46. data/lib/ruby-lokalise-api/resources/screenshot.rb +2 -0
  47. data/lib/ruby-lokalise-api/resources/snapshot.rb +2 -0
  48. data/lib/ruby-lokalise-api/resources/system_language.rb +3 -1
  49. data/lib/ruby-lokalise-api/resources/task.rb +2 -0
  50. data/lib/ruby-lokalise-api/resources/team.rb +2 -0
  51. data/lib/ruby-lokalise-api/resources/team_user.rb +3 -1
  52. data/lib/ruby-lokalise-api/resources/team_user_group.rb +4 -2
  53. data/lib/ruby-lokalise-api/resources/translation.rb +2 -0
  54. data/lib/ruby-lokalise-api/resources/translation_provider.rb +2 -0
  55. data/lib/ruby-lokalise-api/resources/webhook.rb +2 -0
  56. data/lib/ruby-lokalise-api/rest/branches.rb +2 -0
  57. data/lib/ruby-lokalise-api/rest/comments.rb +2 -0
  58. data/lib/ruby-lokalise-api/rest/contributors.rb +2 -0
  59. data/lib/ruby-lokalise-api/rest/custom_translation_statuses.rb +2 -0
  60. data/lib/ruby-lokalise-api/rest/files.rb +2 -0
  61. data/lib/ruby-lokalise-api/rest/keys.rb +2 -0
  62. data/lib/ruby-lokalise-api/rest/languages.rb +2 -0
  63. data/lib/ruby-lokalise-api/rest/orders.rb +2 -0
  64. data/lib/ruby-lokalise-api/rest/payment_cards.rb +2 -0
  65. data/lib/ruby-lokalise-api/rest/projects.rb +2 -0
  66. data/lib/ruby-lokalise-api/rest/screenshots.rb +2 -0
  67. data/lib/ruby-lokalise-api/rest/snapshots.rb +2 -0
  68. data/lib/ruby-lokalise-api/rest/tasks.rb +2 -0
  69. data/lib/ruby-lokalise-api/rest/team_user_group.rb +2 -0
  70. data/lib/ruby-lokalise-api/rest/team_users.rb +2 -0
  71. data/lib/ruby-lokalise-api/rest/teams.rb +2 -0
  72. data/lib/ruby-lokalise-api/rest/translation_providers.rb +2 -0
  73. data/lib/ruby-lokalise-api/rest/translations.rb +2 -0
  74. data/lib/ruby-lokalise-api/rest/webhooks.rb +2 -0
  75. data/lib/ruby-lokalise-api/utils/attribute_helpers.rb +2 -0
  76. data/lib/ruby-lokalise-api/utils/endpoint_helpers.rb +2 -0
  77. data/lib/ruby-lokalise-api/utils/string_utils.rb +2 -0
  78. data/lib/ruby-lokalise-api/version.rb +3 -1
  79. data/ruby-lokalise-api.gemspec +7 -2
  80. data/spec/lib/ruby-lokalise-api/connection_spec.rb +10 -7
  81. data/spec/lib/ruby-lokalise-api/custom_json_parser_spec.rb +9 -5
  82. data/spec/lib/ruby-lokalise-api/error_spec.rb +7 -4
  83. data/spec/lib/ruby-lokalise-api/rest/branches_spec.rb +7 -5
  84. data/spec/lib/ruby-lokalise-api/rest/comments_spec.rb +7 -5
  85. data/spec/lib/ruby-lokalise-api/rest/contributors_spec.rb +6 -4
  86. data/spec/lib/ruby-lokalise-api/rest/custom_translation_statuses_spec.rb +6 -4
  87. data/spec/lib/ruby-lokalise-api/rest/files_spec.rb +4 -2
  88. data/spec/lib/ruby-lokalise-api/rest/keys_spec.rb +8 -6
  89. data/spec/lib/ruby-lokalise-api/rest/languages_spec.rb +8 -6
  90. data/spec/lib/ruby-lokalise-api/rest/orders_spec.rb +4 -2
  91. data/spec/lib/ruby-lokalise-api/rest/payment_cards_spec.rb +5 -3
  92. data/spec/lib/ruby-lokalise-api/rest/projects_spec.rb +6 -4
  93. data/spec/lib/ruby-lokalise-api/rest/screenshots_spec.rb +6 -4
  94. data/spec/lib/ruby-lokalise-api/rest/snapshots_spec.rb +6 -4
  95. data/spec/lib/ruby-lokalise-api/rest/tasks_spec.rb +6 -4
  96. data/spec/lib/ruby-lokalise-api/rest/team_user_groups_spec.rb +8 -6
  97. data/spec/lib/ruby-lokalise-api/rest/team_users_spec.rb +6 -4
  98. data/spec/lib/ruby-lokalise-api/rest/teams_spec.rb +2 -0
  99. data/spec/lib/ruby-lokalise-api/rest/translation_providers_spec.rb +4 -2
  100. data/spec/lib/ruby-lokalise-api/rest/translations_spec.rb +8 -6
  101. data/spec/lib/ruby-lokalise-api/rest/webhooks_spec.rb +4 -2
  102. data/spec/lib/ruby-lokalise-api/utils/snakecase_spec.rb +2 -0
  103. data/spec/lib/ruby-lokalise-api_spec.rb +12 -9
  104. data/spec/spec_helper.rb +8 -1
  105. data/spec/support/test_client.rb +2 -0
  106. data/spec/support/vcr.rb +2 -0
  107. metadata +49 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e19a20b1d025fd711703a9176f3379e9434b91715db88098a6c25aff8e24fa3
4
- data.tar.gz: afbe4d805b7d97b19fb0105e34815e5a8ce49e36d1fe7b497bea8405d826d44e
3
+ metadata.gz: 213522b81ea68100e13e4c615c0e0644430d41d71eb53c1d5ba1302d8b39b6f9
4
+ data.tar.gz: b874f6d28f9b203329223941f04ef152db3ea70861f481471000f76cb37a23c6
5
5
  SHA512:
6
- metadata.gz: 60df98ac6b8065743bd760e4979b94264da22eeebde08f8b199889dada4d591e7491becb64f09684371a97e7da4a4bb7dfa2cdefb590eca754c2bf7ed1684e1a
7
- data.tar.gz: a22de056ac53851456ac434cd3ecec0c8622d19d5a18b37a658c9d6bb71108ae41106868b54297fc569d8f517b4759156d48ccdea93df3abd43a389ab3e3a9f5
6
+ metadata.gz: 1bf506059ee97e1dcfb54652d3f045aa9b6b0219f42cc09a50cf411539e821a44c39eb8237c44d9ffe6586c216762b95e4bc8495950aa18485bd7f39a1781d34
7
+ data.tar.gz: a70ab61cf44444c94fffda756d58dcf9a5b8f813db65d0c93a5ac64d7ab7eb3f509cddd4f162bc7b3ec2591cce7ac059b09667a5a1e915b34ccfa0e8f280862f
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.9.0 (05-Jan-20)
4
+
5
+ * Fixed a couple of bugs
6
+ * Updated Faraday to version 1
7
+
3
8
  ## 2.8.0 (13-Nov-19)
4
9
 
5
10
  * Added methods to [merge branches](https://lokalise.com/api2docs/curl/#transition-merge-a-branch-post):
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  gemspec
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ruby-lokalise-api.svg)](https://badge.fury.io/rb/ruby-lokalise-api)
4
4
  [![Build Status](https://travis-ci.org/lokalise/ruby-lokalise-api.svg?branch=master)](https://travis-ci.org/lokalise/ruby-lokalise-api)
5
+ [![Test Coverage](https://codecov.io/gh/lokalise/ruby-lokalise-api/graph/badge.svg)](https://codecov.io/gh/lokalise/ruby-lokalise-api)
5
6
 
6
7
  Official opinionated Ruby interface for the [Lokalise API](https://lokalise.com/api2docs/curl/) that represents returned data as Ruby objects.
7
8
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake'
2
4
 
3
5
  begin
@@ -13,4 +15,7 @@ require 'rspec/core/rake_task'
13
15
  RSpec::Core::RakeTask.new(:spec)
14
16
 
15
17
  require 'rubocop/rake_task'
16
- RuboCop::RakeTask.new
18
+ RuboCop::RakeTask.new do |task|
19
+ task.requires << 'rubocop-performance'
20
+ task.requires << 'rubocop-rspec'
21
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
4
  require 'yaml'
3
5
  require 'addressable'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ruby-lokalise-api/rest/branches'
2
4
  require 'ruby-lokalise-api/rest/languages'
3
5
  require 'ruby-lokalise-api/rest/teams'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Branch < Base
4
- DATA_KEY_PLURAL = 'Branches'.freeze
6
+ DATA_KEY_PLURAL = 'Branches'
5
7
 
6
8
  class << self
7
9
  def endpoint(project_id, *_args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Contributor < Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class CustomTranslationStatus < Base
4
- DATA_KEY_PLURAL = 'CustomTranslationStatuses'.freeze
6
+ DATA_KEY_PLURAL = 'CustomTranslationStatuses'
5
7
 
6
8
  class << self
7
9
  def endpoint(project_id, *_args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class File < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Key < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class KeyComment < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Order < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class PaymentCard < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Project < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class ProjectComment < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class ProjectLanguage < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Screenshot < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Snapshot < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class SystemLanguage < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Task < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Team < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class TeamUser < Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class TeamUserGroup < Base
4
- DATA_KEY = 'UserGroup'.freeze
6
+ DATA_KEY = 'UserGroup'
5
7
 
6
8
  class << self
7
9
  def endpoint(team_id, *_args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Translation < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class TranslationProvider < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Collections
3
5
  class Webhook < Base
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Connection
3
- BASE_URL = 'https://api.lokalise.co/api2/'.freeze
5
+ BASE_URL = 'https://api.lokalise.co/api2/'
4
6
 
5
7
  def connection(client)
6
8
  options = {
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  class Error < StandardError
3
5
  ClientError = Class.new(self)
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
1
5
  module Lokalise
2
6
  module JsonHandler
3
7
  # JSON custom parser. Uses built-in JSON by default but can be overridden to any other parser
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Request
3
5
  include Lokalise::Connection
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Branch < Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Contributor < Base
4
- ID_KEY = 'user'.freeze
6
+ ID_KEY = 'user'
5
7
  supports :update, :destroy
6
8
 
7
9
  class << self
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class CustomTranslationStatus < Base
4
- ID_KEY = 'status'.freeze
6
+ ID_KEY = 'status'
5
7
  supports :update, :destroy
6
8
 
7
9
  class << self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class File < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Key < Base
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class KeyComment < Base
4
- DATA_KEY = 'Comment'.freeze
5
- ID_KEY = 'comment'.freeze
6
+ DATA_KEY = 'Comment'
7
+ ID_KEY = 'comment'
6
8
  supports :destroy
7
9
 
8
10
  class << self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Order < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class PaymentCard < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Project < Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class ProjectComment < Base
4
- DATA_KEY = 'Comment'.freeze
6
+ DATA_KEY = 'Comment'
5
7
  end
6
8
  end
7
9
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class ProjectLanguage < Base
4
- DATA_KEY = 'Language'.freeze
5
- ID_KEY = 'lang'.freeze
6
+ DATA_KEY = 'Language'
7
+ ID_KEY = 'lang'
6
8
  supports :update, :destroy
7
9
 
8
10
  class << self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Screenshot < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Snapshot < Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class SystemLanguage < Base
4
- DATA_KEY = 'Language'.freeze
6
+ DATA_KEY = 'Language'
5
7
  end
6
8
  end
7
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Task < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class Team < Base
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class TeamUser < Base
4
- ID_KEY = 'user'.freeze
6
+ ID_KEY = 'user'
5
7
  supports :update, :destroy
6
8
 
7
9
  class << self
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Lokalise
2
4
  module Resources
3
5
  class TeamUserGroup < Base
4
- DATA_KEY = 'Group'.freeze
5
- ID_KEY = 'group'.freeze
6
+ DATA_KEY = 'Group'
7
+ ID_KEY = 'group'
6
8
  supports :update, :destroy,
7
9
  [:add_projects, '/projects/add', :update],
8
10
  [:remove_projects, '/projects/remove', :update],