Sha256: 523f12e3e6bcd2c082f16980a8bed4983dfa0cf242859296c3eb4039fbe6fbc0

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module RefinerycmsVimeoVideos
  module Account
    
    # This will extend controllers and models to centralize account setup logic
    
    protected
      
      CONSUMER_KEY_FORMAT = /^\w{32}$/
      CONSUMER_SECRET_FORMAT = /^\w{16}$/
      TOKEN_FORMAT = /^\w{32}$/
      SECRET_FORMAT = /^\w{40}$/
    
      def ready_to_authorize?
        account[:consumer_key] =~ CONSUMER_KEY_FORMAT and account[:consumer_secret] =~ CONSUMER_SECRET_FORMAT
      end

      def authorized?
        account[:token] =~ TOKEN_FORMAT and account[:secret] =~ SECRET_FORMAT
      end
    
      def account
        @account ||= {
          :username => RefinerySetting.find_or_set(:vimeo_username, :value => "Username"),
          :consumer_key => RefinerySetting.find_or_set(:vimeo_consumer_key, :value => "Consumer Key"),
          :consumer_secret => RefinerySetting.find_or_set(:vimeo_consumer_secret, :value => "Consumer Secret"),
          :token => RefinerySetting.find_or_set(:vimeo_token, :value => 'Token'),
          :secret => RefinerySetting.find_or_set(:vimeo_secret, :value => 'Secret')}
      end
      
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-vimeo-videos-0.1.7 lib/refinerycms_vimeo_videos/account.rb
refinerycms-vimeo-videos-0.1.6 lib/refinerycms_vimeo_videos/account.rb
refinerycms-vimeo-videos-0.1.5 lib/refinerycms_vimeo_videos/account.rb