Sha256: 101ed649b10c9086f9548cebcb32d2f3abf7ea25bca3f35343aa96936d28c397

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module GiveyRuby

  class Configuration

    def client(client_options = {})
      @client ||= begin
        # TODO: ensure consumer key and secret
        @api_site    = client_options.include?(:api_site) ? client_options[:api_site] : "http://api.givey.com"
        @api_version = client_options.include?(:api_version) ? client_options[:api_version] : "v2"
        opts         = {:site => @api_site, :authorize_url => "/#{api_version}/oauth/authorize", :token_url => "/#{api_version}/oauth/token", :raise_errors => false}
        @token_file  = client_options.include?(:token_file) ? client_options[:token_file] : "../tmp/givey_token_file"
        OAuth2::Client.new(client_options[:consumer_key], client_options[:consumer_secret], opts) do |builder|
          # POST/PUT params encoders:
          builder.request :multipart
          builder.request :url_encoded
          builder.adapter :net_http
        end
      end
    end

    def api_version
      @api_version
    end

    def api_site
      @api_site
    end

    def token_file
      @token_file
    end

    def token_file=(file_path)
      @token_file = file_path
    end

  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
givey_ruby-0.0.6 lib/givey_ruby/configuration.rb
givey_ruby-0.0.5 lib/givey_ruby/configuration.rb
givey_ruby-0.0.3 lib/givey_ruby/configuration.rb