Sha256: d737d14cd3f997675c2f8f5cc4bb126a63746c986566066f38fd0aaea61193a4

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'omniauth-oauth'
require 'multi_json'

module OmniAuth
  module Strategies
    class PrayerLetters < OmniAuth::Strategies::OAuth
      option :name, 'prayer_letters'

      option :client_options, {
        :site               => 'https://www.prayerletters.com',
        :authorize_path     => '/my/oauth1/authorize',
        :access_token_path  => '/api/oauth1/token',
        :request_token_path => '/api/oauth1/initiate',
        :http_method        => 'post',
        :scheme             => :query_string
      }

      option :permissions, 'contacts.read,contacts.write'

      uid { raw_info['id'] }

      info do
        {
        }
      end

      extra do
        {
          'raw_info' => raw_info
        }
      end

      def raw_info
        @raw_info ||= {} #MultiJson.decode(access_token.get('/v2/people/@me/@self?format=json').body)['entry']
      end

      def request_phase
        options.request_params ||= {}
        options.request_params[:permissions] = options.permissions
        super
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-prayer-letters-0.0.2 lib/omniauth/strategies/prayer_letters.rb