Sha256: b347aa5e078f7fd5ef88da535184851207328e04f234cfefc23333cbf524ae87
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require 'active_support/core_ext/object/blank' require "social_count/version" require "social_count/error" require "social_count/facebook_user" require "social_count/twitter_user" module SocialCount REQUIRED_CREDENTIALS = [:twitter_consumer_key, :twitter_consumer_secret, :twitter_oauth_token, :twitter_oauth_token_secret, :fb_app_id, :fb_app_secret] class Credentials attr_accessor *REQUIRED_CREDENTIALS end class << self def credentials raise SocialCount::Error, "You must set SocialCount.credentials before making an API call" if @credentials.nil? @credentials end def credentials=(credentials) validate_credentials(credentials) @credentials = credentials end private def validate_credentials(_credentials) REQUIRED_CREDENTIALS.each do |attr| raise SocialCount::Error, "SocialCount.credentials must respond to #{attr}" unless _credentials.respond_to?(attr.to_s) raise SocialCount::Error, "SocialCount.credentials.#{attr} cannot be blank" if _credentials.__send__(attr.to_s).blank? end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
social_count-0.0.7 | lib/social_count.rb |
social_count-0.0.6 | lib/social_count.rb |
social_count-0.0.4 | lib/social_count.rb |
social_count-0.0.3 | lib/social_count.rb |