ruby-lokalise-api 8.0.0.rc1 → 8.0.0

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: b7f5c5e9ee2007a925415b1b823a2d1292c2875a4745faf226090796b4762d40
4
- data.tar.gz: 95adfa6da4239686f103ead65616d29d2ad96f4c3df25c402aeb21a0dc120baf
3
+ metadata.gz: 95932448d2e531abc5dc2f30a4b7f1052fa9ba7b37a80e57a46117ac7102c453
4
+ data.tar.gz: d5101a2713268265021177c3bcb1eaa1adcfaaa2afe605d87747d55a5c4a6ec0
5
5
  SHA512:
6
- metadata.gz: 6b8b417199e57e73453a065707529422f4cdcd4b4f173138b01fed63ecc404bf7df9c78c374da40fa4551174406369c7c2b213d2dd557c9465874c15ac87c598
7
- data.tar.gz: bfba53bd1b7e8a65bb8e778de4f379f05a4415a43bf16405b2af7f2e6fdece3adacac4a086e20d029523a196248adbaaca04e9ebc71c40fe3a9775cf945c75f8
6
+ metadata.gz: 64d290aa2c9844f3e8db8099968104845f7f7b7a52c96843b7f400124819031c3021acec02a318004079548b2666e3253cae845d447825cb5acf04d7cee43234
7
+ data.tar.gz: f2790492035aa26cd353372008fe8b4d41cecd47382700ec339e57d443cb5e637be24dc299ea7a1c9898f5c2446722a5709e79e684c081b1ee730d595788fb5e
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubyLokaliseApi
4
4
  module Concerns
5
+ # Allows to set supported attributes for classes
5
6
  module AttrsLoadable
6
7
  class << self
7
8
  def extended(klass)
@@ -3,7 +3,6 @@
3
3
  module RubyLokaliseApi
4
4
  # Module to setup connection using Faraday
5
5
  module Connection
6
-
7
6
  # Creates a new Faraday object with specified params
8
7
  def connection(endpoint)
9
8
  Faraday.new(options(endpoint), request_params_for(endpoint.client)) do |faraday|
@@ -2,6 +2,7 @@
2
2
 
3
3
  module RubyLokaliseApi
4
4
  module OAuth2
5
+ # This class defines OAuth2 flow
5
6
  class Auth
6
7
  attr_reader :client_id, :client_secret, :timeout, :open_timeout
7
8
 
@@ -14,10 +15,17 @@ module RubyLokaliseApi
14
15
  @open_timeout = params[:open_timeout]
15
16
  end
16
17
 
18
+ # Returns OAuth2 endpoint URI
17
19
  def oauth2_endpoint
18
20
  self.class.const_get(:OAUTH2_ENDPOINT)
19
21
  end
20
22
 
23
+ # Builds an OAuth2 link that customers have to visit
24
+ # in order to obtain a special code
25
+ # @return [String]
26
+ # @param scope [Array, String]
27
+ # @param redirect_uri [String]
28
+ # @param state [String]
21
29
  def auth(scope:, redirect_uri: nil, state: nil)
22
30
  get_params = {
23
31
  client_id: client_id,
@@ -29,6 +37,10 @@ module RubyLokaliseApi
29
37
  oauth2_endpoint.new(self, query: 'auth', get: get_params).full_uri
30
38
  end
31
39
 
40
+ # Requests OAuth2 access token. Requires OAuth2 code obtained
41
+ # using the `.auth` method
42
+ # @return [RubyLokaliseApi::Resources::OAuth2Token]
43
+ # @param code [String]
32
44
  def token(code)
33
45
  endpoint = oauth2_endpoint.new(
34
46
  self,
@@ -42,6 +54,9 @@ module RubyLokaliseApi
42
54
  RubyLokaliseApi::Resources::OAuth2Token.new endpoint.do_post
43
55
  end
44
56
 
57
+ # Refreshes expired OAuth2 access token.
58
+ # @return [RubyLokaliseApi::Resources::OAuth2RefreshedToken]
59
+ # @param refresh_token [String]
45
60
  def refresh(refresh_token)
46
61
  endpoint = oauth2_endpoint.new(
47
62
  self,
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLokaliseApi
4
+ # Basic utilitiy methods
4
5
  module Utils
5
6
  module Classes
6
7
  refine Object do
@@ -9,10 +10,13 @@ module RubyLokaliseApi
9
10
  name.split('::').last
10
11
  end
11
12
 
13
+ # Converts object to array unless it is already an array
12
14
  def to_array
13
15
  is_a?(Array) ? self : [self]
14
16
  end
15
17
 
18
+ # Converts object to array and then places this array
19
+ # inside hash under the provided key
16
20
  def to_array_obj(key)
17
21
  return self if is_a?(Hash) && (key?(key) || key?(key.to_s))
18
22
 
@@ -5,6 +5,8 @@ module RubyLokaliseApi
5
5
  module Keys
6
6
  using RubyLokaliseApi::Utils::Strings
7
7
 
8
+ # Reads DATA_KEY for resources. DATA_KEY specifies the name of the key
9
+ # in the API response that contains the actual data
8
10
  def data_key_for(klass:)
9
11
  key = if Module.const_defined? "RubyLokaliseApi::Resources::#{klass}::DATA_KEY"
10
12
  Module.const_get "RubyLokaliseApi::Resources::#{klass}::DATA_KEY"
@@ -15,6 +17,8 @@ module RubyLokaliseApi
15
17
  key.snakecase
16
18
  end
17
19
 
20
+ # Reads DATA_KEY for collections. DATA_KEY specifies the name of the key
21
+ # in the API response that contains the actual data
18
22
  def collection_key_for(klass:)
19
23
  key = if Module.const_defined?("RubyLokaliseApi::Collections::#{klass}::DATA_KEY")
20
24
  Module.const_get("RubyLokaliseApi::Collections::#{klass}::DATA_KEY")
@@ -5,16 +5,19 @@ module RubyLokaliseApi
5
5
  module Loaders
6
6
  private
7
7
 
8
+ # Instantiates an endpoint
8
9
  def endpoint(name:, client: self, params: {})
9
10
  klass = RubyLokaliseApi.const_get "Endpoints::#{name}Endpoint"
10
11
  klass.new client, params
11
12
  end
12
13
 
14
+ # Instantiates a resource
13
15
  def resource(name, data)
14
16
  klass = RubyLokaliseApi.const_get "Resources::#{name}"
15
17
  klass.new data
16
18
  end
17
19
 
20
+ # Instantiates a collection
18
21
  def collection(name, data)
19
22
  klass = RubyLokaliseApi.const_get "Collections::#{name}"
20
23
  klass.new data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLokaliseApi
4
- VERSION = '8.0.0.rc1'
4
+ VERSION = '8.0.0'
5
5
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'addressable', '~> 2.5'
25
25
  spec.add_dependency 'faraday', '~> 2.0'
26
- spec.add_dependency 'faraday-gzip', '>= 0.1', '< 2.0'
26
+ spec.add_dependency 'faraday-gzip', '~> 2.0'
27
27
  spec.add_dependency 'json', '~> 2'
28
28
  spec.add_dependency 'zeitwerk', '~> 2.4'
29
29
 
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.0.rc1
4
+ version: 8.0.0
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-07-20 00:00:00.000000000 Z
11
+ date: 2023-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -42,20 +42,14 @@ dependencies:
42
42
  name: faraday-gzip
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0.1'
48
- - - "<"
45
+ - - "~>"
49
46
  - !ruby/object:Gem::Version
50
47
  version: '2.0'
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: '0.1'
58
- - - "<"
52
+ - - "~>"
59
53
  - !ruby/object:Gem::Version
60
54
  version: '2.0'
61
55
  - !ruby/object:Gem::Dependency
@@ -399,11 +393,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
399
393
  version: '2.7'
400
394
  required_rubygems_version: !ruby/object:Gem::Requirement
401
395
  requirements:
402
- - - ">"
396
+ - - ">="
403
397
  - !ruby/object:Gem::Version
404
- version: 1.3.1
398
+ version: '0'
405
399
  requirements: []
406
- rubygems_version: 3.4.15
400
+ rubygems_version: 3.4.17
407
401
  signing_key:
408
402
  specification_version: 4
409
403
  summary: Ruby interface to the Lokalise API