Top Level Namespace

Defined Under Namespace

Modules: Lasso

Instance Method Summary collapse

Instance Method Details

#define_oauth_one(parent) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lasso/model/oauth_one.rb', line 1

def define_oauth_one(parent)
  eval "    class OAuthOne\#{parent} < \#{parent}\n\n      alias_attribute :oauth_token,        :token_a\n      alias_attribute :oauth_token_secret, :token_b\n\n      validates_presence_of :oauth_token, :oauth_token_secret\n\n      def client\n        @client ||= OAuth::Consumer.new(config(:key), config(:secret), :site => config(:site), :request_token_path => config(:request_token_path), :authorize_path => config(:authorize_path), :access_token_path => config(:access_token_path))\n      end\n\n      def access\n        @access ||= OAuth::AccessToken.new(client, oauth_token, oauth_token_secret)\n      end\n\n    end\n"
end

#define_oauth_two(parent) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lasso/model/oauth_two.rb', line 1

def define_oauth_two(parent)
  eval "    class OAuthTwo\#{parent} < \#{parent}\n\n      alias_attribute :access_token,  :token_a\n      alias_attribute :refresh_token, :token_b\n  \n      validates_presence_of :access_token\n  \n      def client\n        @client ||= OAuth2::Client.new(config(:key), config(:secret), :site => config(:site), :authorize_path => config(:authorize_path), :type => 'web_server', :access_token_path => config(:access_token_path))\n      end\n  \n      def access\n        @access ||= OAuth2::AccessToken.new(client, access_token, refresh_token)\n      end\n    end\n"
end