Sha256: 348b9f933070ead70ca1d804c44aa89411f70eda4a29703608ed3b543bb07f1a

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require 'zeitwerk'
require 'faraday'
require 'faraday/gzip'
require 'yaml'
require 'addressable'

loader = Zeitwerk::Loader.for_gem
loader.inflector.inflect(
  'oauth2' => 'OAuth2',
  'oauth2_client' => 'OAuth2Client'
)
loader.setup

module RubyLokaliseApi
  class << self
    # Initializes a new Client object
    #
    # @return [RubyLokaliseApi::Client]
    # @param token [String]
    # @param params [Hash]
    def client(token, params = {})
      @client = RubyLokaliseApi::Client.new token, params
    end

    # Reset the currently set client
    def reset_client!
      @client = nil
    end

    # Initializes a new OAuth2Client object
    #
    # @return [RubyLokaliseApi::OAuth2Client]
    # @param token [String]
    # @param params [Hash]
    def oauth2_client(token, params = {})
      @oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params
    end

    # Reset the currently set OAuth2 client
    def reset_oauth2_client!
      @oauth2_client = nil
    end

    # Initializes a new Auth client to request OAuth 2 tokens
    #
    # @return [RubyLokaliseApi::OAuth2::Auth]
    # @param client_id [String]
    # @param client_secret [String]
    # @param params [Hash]
    def auth_client(client_id, client_secret, params = {})
      RubyLokaliseApi::OAuth2::Auth.new client_id, client_secret, params
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-lokalise-api-7.2.0 lib/ruby_lokalise_api.rb
ruby-lokalise-api-7.1.1 lib/ruby_lokalise_api.rb
ruby-lokalise-api-7.1.0 lib/ruby_lokalise_api.rb
ruby-lokalise-api-7.0.0 lib/ruby_lokalise_api.rb