diff --git a/oa-basic/dist/oa-basic-0.0.3/lib/omniauth/strategies/basecamp.rb b/oa-basic/dist/oa-basic-0.0.3/lib/omniauth/strategies/basecamp.rb deleted file mode 100644 index 3db78e3..0000000 --- a/oa-basic/dist/oa-basic-0.0.3/lib/omniauth/strategies/basecamp.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'omniauth/basic' - -module OmniAuth - module Strategies - class Basecamp < HttpBasic - def initialize(app) - require 'json' - super(app, :basecamp, nil) - end - - def endpoint - "http://#{request.params['user']}:#{request.params['password']}@#{request.params['subdomain']}.basecamphq.com/me.xml" - end - - def perform_authentication(endpoint) - super(endpoint) rescue super(endpoint.sub('http','https')) - end - - def auth_hash - doc = Nokogiri::XML.parse(@response.body) - OmniAuth::Utils.deep_merge(super, { - 'uid' => doc.xpath('person/id').text, - 'user_info' => user_info(doc), - 'credentials' => { - 'token' => doc.xpath('person/token').text - } - }) - end - - def user_info(doc) - hash = { - 'nickname' => request.params['user'], - 'first_name' => doc.xpath('person/first-name').text, - 'last_name' => doc.xpath('person/last-name').text, - 'email' => doc.xpath('person/email-address').text, - 'image' => doc.xpath('person/avatar-url').text - } - - hash['name'] = [hash['first_name'], hash['last_name']].join(' ').strip - - hash.delete('image') if hash['image'].include?('missing/avatar.png') - - hash - end - - def get_credentials - OmniAuth::Form.build('Basecamp Authentication') do - text_field 'Subdomain', 'subdomain' - text_field 'Username', 'user' - password_field 'Password', 'password' - end.to_response - end - end - end -end diff --git a/oa-basic/dist/oa-basic-0.0.3/lib/omniauth/strategies/campfire.rb b/oa-basic/dist/oa-basic-0.0.3/lib/omniauth/strategies/campfire.rb deleted file mode 100644 index 60b0cfd..0000000 --- a/oa-basic/dist/oa-basic-0.0.3/lib/omniauth/strategies/campfire.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'omniauth/basic' - -module OmniAuth - module Strategies - class Campfire < HttpBasic - def initialize(app) - require 'json' - super(app, :campfire, nil) - end - - def endpoint - "http://#{request.params['user']}:#{request.params['password']}@#{request.params['subdomain']}.campfirenow.com/users/me.json" - end - - def perform_authentication(endpoint) - super(endpoint) rescue super(endpoint.sub('http','https')) - end - - def auth_hash - user_hash = JSON.parse(@response.body)['user'] - OmniAuth::Utils.deep_merge(super, { - 'uid' => user_hash['id'], - 'user_info' => user_info(user_hash), - 'credentials' => { - 'token' => user_hash['api_auth_token'] - } - }) - end - - def user_info(hash) - { - 'nickname' => request.params['user'], - 'name' => hash['name'], - 'email' => hash['email_address'] - } - end - - def get_credentials - OmniAuth::Form.build('Campfire Authentication') do - text_field 'Subdomain', 'subdomain' - text_field 'Username', 'user' - password_field 'Password', 'password' - end.to_response - end - end - end -end