1
0

tumblr_concern.rb 667 B

123456789101112131415161718192021222324252627282930313233343536
  1. module TumblrConcern
  2. extend ActiveSupport::Concern
  3. included do
  4. include Oauthable
  5. valid_oauth_providers :tumblr
  6. end
  7. def tumblr_consumer_key
  8. ENV['TUMBLR_OAUTH_KEY']
  9. end
  10. def tumblr_consumer_secret
  11. ENV['TUMBLR_OAUTH_SECRET']
  12. end
  13. def tumblr_oauth_token
  14. service.token
  15. end
  16. def tumblr_oauth_token_secret
  17. service.secret
  18. end
  19. def tumblr
  20. Tumblr.configure do |config|
  21. config.consumer_key = tumblr_consumer_key
  22. config.consumer_secret = tumblr_consumer_secret
  23. config.oauth_token = tumblr_oauth_token
  24. config.oauth_token_secret = tumblr_oauth_token_secret
  25. end
  26. Tumblr::Client.new
  27. end
  28. end