diff options
| author | Peter Mangiafico | 2011-04-02 15:13:36 -0700 |
|---|---|---|
| committer | Chris Sepic | 2011-06-28 17:24:00 -0500 |
| commit | 3c72845c3ffe50bdcba3921a3c51f00331f77a5e (patch) | |
| tree | 8c6d32fa9925611313b1630db993f9169d3433b7 | |
| parent | 4a802c59a501cd9a25bedd75bce7ab12f4edf5bc (diff) | |
| download | evernote-3c72845c3ffe50bdcba3921a3c51f00331f77a5e.tar.bz2 | |
remove need to have configuration parameters in a YML file, allow a generic hash to be passed in instead
| -rw-r--r-- | README.mkd | 21 | ||||
| -rw-r--r-- | lib/evernote/user_store.rb | 3 |
2 files changed, 5 insertions, 19 deletions
@@ -2,27 +2,14 @@ This gem is a high level wrapper around Evernote's Thrift-generated ruby code. It bundles up Evernote's thrift-generated code and creates some simple wrapper classes. # usage # -Create a config yml: - - sandbox: - username: user - password: password - consumer_key: key - consumer_secret: secret - - production: - username: user - password: password - consumer_key: key - consumer_secret: secret - -Here's an example using the sandbox key: +Get yourself an API key from Evernote, which gives you a "consumer_key" and "consumer_secret". Put those in a YML file or any other place you put configuration information. Also, get yourself a username and password (probably on their sandbox system). + require 'evernote' user_store_url = "https://sandbox.evernote.com/edam/user" - config = File.dirname(__FILE__) + "/config.yml" - user_store = Evernote::UserStore.new(user_store_url, config, "sandbox") + config={'username'=>'YOUR_USERNAME','password'=>'YOUR_PASSWORD','consumer_key'=>'YOUR_CONSUMER_KEY_FROM_EVERNOTE','consumer_secret'=>'YOUR_CONSUMER_SECRECT_FROM_EVERNOTE'} + user_store = Evernote::UserStore.new(user_store_url, config) auth_result = user_store.authenticate user = auth_result.user diff --git a/lib/evernote/user_store.rb b/lib/evernote/user_store.rb index b8b6102..44574fc 100644 --- a/lib/evernote/user_store.rb +++ b/lib/evernote/user_store.rb @@ -5,8 +5,7 @@ module Evernote class UserStore AuthenticationFailure = Class.new(StandardError) - def initialize(uri, auth_file, auth_env, thrift_client_options = {}) - credentials = YAML.load_file(auth_file)[auth_env.to_s] + def initialize(uri, credentials, thrift_client_options = {}) @consumer_key = credentials["consumer_key"] @consumer_secret = credentials["consumer_secret"] |
