Sha256: b564607226cf70419740fd37c50886580c78c32bb186484e522e3c806c0bb188

Contents?: true

Size: 948 Bytes

Versions: 3

Compression:

Stored size: 948 Bytes

Contents

require 'sinatra'
$:.unshift File.expand_path('../../lib', __FILE__)
require 'flattr'
require 'haml'

require 'yaml'
local_config = YAML.load_file './local_config.yml'

layout :default
set :session, :enable

before do
  puts " -- #{request.request_method.upcase} #{request.path_info} --"
  @flattr_client = Flattr.new(
    :client_id    => local_config['client_id'],
    :client_secret => local_config['client_secret'],
    :authorize_endpoint => local_config['authorize_endpoint'],
    :token_endpoint => local_config['token_endpoint']
  )
end
get '/' do
  haml :index
end

get '/callback' do
  puts "callback params: #{params.inspect}"
  token = @flattr_client.get_access_token params["code"]
  puts "token is : #{token}"
  redirect '/tests'
end

get '/open_calls' do
  @user = @flattr_client.user('smgt')
  @categories = @flattr_client.categories
  @languages = @flattr_client.languages
  haml :open_calls
end

get '/tests' do
  haml :tests
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flattr-0.2.3 example_app/app.rb
flattr-0.2.2 example_app/app.rb
flattr-0.2.1 example_app/app.rb