Sha256: b083f5a8a8e466660e5e0975eb9a8b7fbabe7027d68fe467c3cdbb3abe2e6a93

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

require 'httparty'

module Openlab
  class Client
    include HTTParty
    default_timeout 5
    attr_reader :app_secret
    format :json

    def initialize(app_secret: nil)
      @app_secret = app_secret || Openlab.config.app_secret
      app_secret = @app_secret

      self.class.base_uri Openlab.config.base_uri
      self.class.headers 'Accept' => 'application/json', 'Authorization' => "Token token=#{app_secret}"
    end

    def projects
      @projects ||= Openlab::Projects.new(self)
    end

    def method_missing(method_name, *arguments, &block)
      self.class.respond_to?(method_name) ? self.class.__send__(method_name, *arguments, &block) : super
    end

    def respond_to?(method_name, include_private = false)
      self.class.respond_to?(method_name) || super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openlab_ruby-0.0.5 lib/openlab/client.rb
openlab_ruby-0.0.4 lib/openlab/client.rb
openlab_ruby-0.0.3 lib/openlab/client.rb