ruby-lokalise-api 8.0.1 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9dd635ba92d1885a962876708929e92b3d4cf27da08281d37d001090b26059e
4
- data.tar.gz: 4360d59c199a2f166fc1ea0a7d6cbe767ff9fef1ad4915c7ea432fe96a5520a6
3
+ metadata.gz: 757096e9bd784d9fbb217a9f5717b22e76fc33789cb7afbc64c0dc40d1e5cae0
4
+ data.tar.gz: b1ef581136fae9704cc4acf570b7b29dbe2bcb757229594a98954aefae5229d8
5
5
  SHA512:
6
- metadata.gz: d5dc497254da7a8b9d887f449880a37c5d3ab71054a23d07aac90cdedb27896103b3ed907fda102c0785da068bc50dccce1b8f1723a0a71c78bb9c6896347fb7
7
- data.tar.gz: de6153458925151cfd3ee5640d8dbea226877ba89698faf2e6320776340e5dafd37bb62e8297f04377e50918fdaa40c698020aa0f098466a488410f2fb3ffba3
6
+ metadata.gz: 929cae40ddbeffd97804beea0751dfd4e35bb2a5a76643c8da8cd4ce3148e9d0ed457d58a81e4f550ddb4dfb7c009b49bdbd4009392a13e10dfcf0f1c709a8fb
7
+ data.tar.gz: 98ea093d57d3ad8126e895da2a6a964d21a83eaed661dadb74c848e947162dea75605f3381c93a10ffe05245bae65629b1813076adddcb4ed6f3931e1a7a1adb
@@ -86,7 +86,7 @@ module RubyLokaliseApi
86
86
 
87
87
  def populate_common_attrs_from(response)
88
88
  supported_attrs.each do |attrib|
89
- instance_variable_set "@#{attrib}", response.content[attrib]
89
+ instance_variable_set :"@#{attrib}", response.content[attrib]
90
90
  end
91
91
 
92
92
  headers = response.headers
@@ -38,7 +38,7 @@ module RubyLokaliseApi
38
38
  # Creates methods like `do_post`, `do_get` that proxy calls to the
39
39
  # corresponding methods in the `Request` module
40
40
  HTTP_METHODS.each do |method_postfix|
41
- define_method "do_#{method_postfix}" do
41
+ define_method :"do_#{method_postfix}" do
42
42
  send method_postfix, self
43
43
  end
44
44
  end
@@ -6,7 +6,7 @@ module RubyLokaliseApi
6
6
  BASE_URL = 'https://api.lokalise.com/api2'
7
7
 
8
8
  def initialize(client, params = {})
9
- super client, params
9
+ super(client, params)
10
10
 
11
11
  @uri = partial_uri(base_query(*@query_params))
12
12
  end
@@ -8,7 +8,7 @@ module RubyLokaliseApi
8
8
  PARTIAL_URI_TEMPLATE = '{/segments*}{?query*}'
9
9
 
10
10
  def initialize(client, params = {})
11
- super client, params
11
+ super(client, params)
12
12
 
13
13
  @uri = partial_uri(base_query(*@query_params), params.fetch(:get, []))
14
14
  end
@@ -40,7 +40,12 @@ module RubyLokaliseApi
40
40
  class << self
41
41
  # Create a new error from an HTTP response
42
42
  def from_response(body)
43
- msg = body.key?('error') ? body['error']['message'] : body['message']
43
+ msg = if body.respond_to?(:key)
44
+ body.key?('error') ? body['error']['message'] : body['message']
45
+ else
46
+ body
47
+ end
48
+
44
49
  new msg.to_s
45
50
  end
46
51
  end
@@ -14,7 +14,7 @@ module RubyLokaliseApi
14
14
 
15
15
  def initialize(raw_data)
16
16
  raw_data.each do |att, val|
17
- instance_variable_set "@#{att}", val
17
+ instance_variable_set :"@#{att}", val
18
18
 
19
19
  self.class.class_exec do
20
20
  attr_reader att.to_sym
@@ -63,7 +63,11 @@ module RubyLokaliseApi
63
63
  end
64
64
 
65
65
  def respond_with(response, endpoint)
66
- body = custom_load response.body
66
+ begin
67
+ body = custom_load response.body
68
+ rescue JSON::ParserError
69
+ respond_with_error(response.status, response.body)
70
+ end
67
71
 
68
72
  raise_on_error! response, body
69
73
 
@@ -49,7 +49,7 @@ module RubyLokaliseApi
49
49
 
50
50
  def read_main_params
51
51
  self.class.const_get(:MAIN_PARAMS).to_array.map do |param|
52
- instance_variable_get "@#{param}"
52
+ instance_variable_get :"@#{param}"
53
53
  end
54
54
  end
55
55
 
@@ -69,7 +69,7 @@ module RubyLokaliseApi
69
69
  content[attrib]
70
70
  end
71
71
 
72
- instance_variable_set "@#{attrib}", value
72
+ instance_variable_set :"@#{attrib}", value
73
73
  end
74
74
  end
75
75
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLokaliseApi
4
- VERSION = '8.0.1'
4
+ VERSION = '9.0.1'
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = 'https://github.com/lokalise/ruby-lokalise-api'
13
13
  spec.license = 'BSD-3-Clause'
14
14
  spec.platform = Gem::Platform::RUBY
15
- spec.required_ruby_version = '>= 2.7'
15
+ spec.required_ruby_version = '>= 3.0'
16
16
 
17
17
  spec.files = Dir['README.md', 'LICENSE',
18
18
  'CHANGELOG.md', 'lib/**/*.rb', 'lib/ruby_lokalise_api/data/*.yml',
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'json', '~> 2'
28
28
  spec.add_dependency 'zeitwerk', '~> 2.4'
29
29
 
30
- spec.add_development_dependency 'dotenv', '~> 2.5'
30
+ spec.add_development_dependency 'dotenv', '~> 3.0'
31
31
  spec.add_development_dependency 'oj', '~> 3.10'
32
32
  spec.add_development_dependency 'rake', '~> 13.0'
33
33
  spec.add_development_dependency 'rspec', '~> 3.6'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lokalise-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 9.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.5'
89
+ version: '3.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.5'
96
+ version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: oj
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -390,14 +390,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
390
390
  requirements:
391
391
  - - ">="
392
392
  - !ruby/object:Gem::Version
393
- version: '2.7'
393
+ version: '3.0'
394
394
  required_rubygems_version: !ruby/object:Gem::Requirement
395
395
  requirements:
396
396
  - - ">="
397
397
  - !ruby/object:Gem::Version
398
398
  version: '0'
399
399
  requirements: []
400
- rubygems_version: 3.4.18
400
+ rubygems_version: 3.5.6
401
401
  signing_key:
402
402
  specification_version: 4
403
403
  summary: Ruby interface to the Lokalise API