Class: Yinx::UserStore
- Inherits:
-
Object
- Object
- Yinx::UserStore
- Defined in:
- lib/yinx/user_store.rb
Constant Summary collapse
- SANDBOX =
"sandbox.evernote.com"- REAL =
REAL = “www.evernote.com”
"app.yinxiang.com"- TOKEN =
"#{ENV['HOME']}/.yinx"
Instance Attribute Summary collapse
-
#userStore ⇒ Object
readonly
Returns the value of attribute userStore.
Instance Method Summary collapse
- #checkVersion ⇒ Object
- #default_token ⇒ Object
- #host ⇒ Object
-
#initialize(real_env = true) ⇒ UserStore
constructor
A new instance of UserStore.
- #note_store(authToken = default_token) ⇒ Object
Constructor Details
#initialize(real_env = true) ⇒ UserStore
Returns a new instance of UserStore.
15 16 17 18 19 20 21 |
# File 'lib/yinx/user_store.rb', line 15 def initialize real_env = true @real = real_env userStoreUrl = "https://#{host}/edam/user" userStoreTransport = Thrift::HTTPClientTransport.new(userStoreUrl) userStoreProtocol = Thrift::BinaryProtocol.new(userStoreTransport) @userStore = Evernote::EDAM::UserStore::UserStore::Client.new(userStoreProtocol) end |
Instance Attribute Details
#userStore ⇒ Object (readonly)
Returns the value of attribute userStore.
7 8 9 |
# File 'lib/yinx/user_store.rb', line 7 def userStore @userStore end |
Instance Method Details
#checkVersion ⇒ Object
27 28 29 30 31 |
# File 'lib/yinx/user_store.rb', line 27 def checkVersion userStore.checkVersion("Evernote EDAMTest (Ruby)", Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR, Evernote::EDAM::UserStore::EDAM_VERSION_MINOR) end |
#default_token ⇒ Object
37 38 39 40 |
# File 'lib/yinx/user_store.rb', line 37 def default_token return ENV['YINX'] if ENV['YINX'] File.exist?(TOKEN) ? File.read(TOKEN).chomp : nil end |
#host ⇒ Object
23 24 25 |
# File 'lib/yinx/user_store.rb', line 23 def host @real ? REAL : SANDBOX end |
#note_store(authToken = default_token) ⇒ Object
33 34 35 |
# File 'lib/yinx/user_store.rb', line 33 def note_store authToken = default_token NoteStore.new userStore, authToken end |