Sha256: ca328a01cf30a80478aa59caea0a37d619d1eeddcf1e3ecb1521fda5721a87aa
Contents?: true
Size: 1.26 KB
Versions: 6
Compression:
Stored size: 1.26 KB
Contents
module OurKudos module Acts module Client def self.included(base) base.extend AddActsAsOurKudosClient end module AddActsAsOurKudosClient def acts_as_ourkudos_client(options = {:token => :authentication_token}) cattr_reader :application_id, :application_secret, :ourkudos_host class_eval <<-RUBY include OurKudos::Acts::Client::InstanceMethods if defined?(Devise) && Devise.omniauth_configs[:ourkudos] @@application_id, @@application_secret = Devise.omniauth_configs[:ourkudos].args[0..1] @@ourkudos_host = Devise.omniauth_configs[:ourkudos].args[2][:site] else raise "Please put correct config in devise initializer i.e. config.omniauth :ourkduos 'app_id', 'app_secret'" end RUBY end end module InstanceMethods def client @client ||= OAuth2::Client.new self.application_id, self.application_secret, :site => self.ourkudos_host end def ourkudos @ourkudos ||= OAuth2::AccessToken.new(client, self.authentication_token) end module ClassMethods end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems