summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/evernote/user_store.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/evernote/user_store.rb b/lib/evernote/user_store.rb
index 44574fc..884ca24 100644
--- a/lib/evernote/user_store.rb
+++ b/lib/evernote/user_store.rb
@@ -7,10 +7,14 @@ module Evernote
def initialize(uri, credentials, thrift_client_options = {})
- @consumer_key = credentials["consumer_key"]
- @consumer_secret = credentials["consumer_secret"]
- @username = credentials["username"]
- @password = credentials["password"]
+ raise ArgumentError, "credentials must be passed in as a hash" unless credentials.class == Hash
+
+ credentials=credentials.inject({}) { |h,(k,v)| h[k.to_sym] = v; h } # convert any stringifyed hash keys into symbols
+
+ @consumer_key = credentials[:consumer_key]
+ @consumer_secret = credentials[:consumer_key]
+ @username = credentials[:username]
+ @password = credentials[:password]
unless @consumer_key && @consumer_secret && @username && @password
raise ArgumentError, "'consumer_key', 'consumer_secret', 'username' and 'password' are required"