Sha256: a26ef13d2bc8164caf88dade9eb24490e3a917f33be6e26a3d856ce08018641e

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

require 'sphere_engine/error'

module SphereEngine
  class Client
    attr_accessor :access_token_compilers, :access_token_problems

    # Initializes a new Client object
    #
    # @param options [Hash]
    # @return [SphereEngine::Client]
    def initialize(options = {})
      options.each do |key, value|
        instance_variable_set("@#{key}", value)
      end
      yield(self) if block_given?
    end

    # @return [Hash]
    def credentials
      {
        access_token_compilers: access_token_compilers,
        access_token_problems: access_token_problems
      }
    end

    # @return [Boolean]
    def credentials?
      credentials.values.all?
    end

    # @return[String]
    def get_token(service)
      return case service
      when :compillers
        access_token_compilers
      when :problems
        access_token_problems
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sphere_engine-1.1.0.pre lib/sphere_engine/client.rb