Giter Site home page Giter Site logo

evernote-sdk-ruby's Introduction

Gem Version

Evernote SDK for Ruby

Evernote API version 1.25

Overview

This SDK contains wrapper code used to call the Evernote Cloud API from Ruby.

The SDK also contains two samples. The code in sample/client demonstrates the basic use of the SDK for single-user scripts. The code in sample/oauth demonstrates the basic use of the SDK for web applications that authenticate using OAuth.

Install the gem

gem install evernote-thrift

Prerequisites

In order to use the code in this SDK, you need to obtain an API key from http://dev.evernote.com/documentation/cloud. You'll also find full API documentation on that page.

In order to run the sample code, you need a user account on the sandbox service where you will do your development. Sign up for an account at https://sandbox.evernote.com/Registration.action

In order to run the client client sample code, you need a developer token. Get one at https://sandbox.evernote.com/api/DeveloperToken.action

Getting Started - Client

The code in sample/client/EDAMTest.rb demonstrates the basics of using the Evernote API, using developer tokens to simplify the authentication process while you're learning.

  1. Open sample/client/EDAMTest.rb

  2. Scroll down and fill in your Evernote developer token.

  3. On the command line, run the following command to execute the script:

    ruby EDAMTest.rb

Getting Started - OAuth

Web applications must use OAuth to authenticate to the Evernote service. The code in sample/oauth contains 2 simple web apps that demonstrate the OAuth authentication process. The applications use the Sinatra framework. You don't need to use Sinatra for your application, but you'll need it to run the sample code. The applications also use the OAuth RubyGem to provide the underlying OAuth functionality.

There are two pages in the sample. evernote_oauth.rb demonstrates each step of the OAuth process in detail. This is useful for developers, but not what an end user would see. evernote_oauth_simple demonstrates the simplified process, which is similar to what you would implement in your production app.

  1. Install Sinatra: gem install sinatra

  2. Install OAuth: gem install oauth

  3. Open the file sample/oauth/evernote_config.rb

  4. Fill in your Evernote API consumer key and secret.

  5. On the command line, run the following command to start the datailed sample app:

    ruby -rubygems evernote_oauth.rb

  6. Open the sample app in your browser: http://localhost:4567

  7. Repeat steps 5 and 6 with the file evernote_oauth_simple.rb to run the simple sample app.

Getting Started - evernote_oauth gem

We also provide a high level wrapper for the Thrift API client. You can install it with: gem install evernote_oauth

For more detail, see: https://github.com/evernote/evernote-oauth-ruby

evernote-sdk-ruby's People

Contributors

balser avatar conch avatar psalaets avatar rekotan avatar thash avatar topac avatar volpe28v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evernote-sdk-ruby's Issues

Client sample is not working with production server

Following code (taken from client sample) is working fine with sandbox server, but failing with production one:

require 'evernote-thrift'

evernoteHost = "evernote.com"
userStoreUrl = "https://#{evernoteHost}/edam/user"

userStoreTransport = Thrift::HTTPClientTransport.new(userStoreUrl)
userStoreProtocol = Thrift::BinaryProtocol.new(userStoreTransport)
userStore = Evernote::EDAM::UserStore::UserStore::Client.new(userStoreProtocol)

versionOK = userStore.checkVersion("Evernote EDAMTest (Ruby)",
                                         Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR,
                                         Evernote::EDAM::UserStore::EDAM_VERSION_MINOR)

Here is the exception that is raised on the last line:

/Users/cug/Source/evernote/vendor/ruby/1.9.1/gems/evernote-thrift-1.23.1/lib/thrift/protocol/binary_protocol.rb:131:in `read_message_begin': No version     identifier, old protocol client? (Thrift::ProtocolException)
from /Users/cug/Source/evernote/vendor/ruby/1.9.1/gems/evernote-thrift-1.23.1/lib/thrift/client.rb:45:in `receive_message'
from /Users/cug/Source/evernote/vendor/ruby/1.9.1/gems/evernote-thrift-1.23.1/lib/Evernote/EDAM/user_store.rb:27:in `recv_checkVersion'
from /Users/cug/Source/evernote/vendor/ruby/1.9.1/gems/evernote-thrift-1.23.1/lib/Evernote/EDAM/user_store.rb:19:in `checkVersion'
from test.rb:10:in `<main>'

if evernoteHost is changed to sandbox.evernote.com everything is working fine.

SC

9863/88845,210812.016

Contributing additional helper methods for the evernote SDK

As part of an app I'm working on, I extended the Evernote::EDAM::NoteStore::NoteStore::Client class to add a few helper methods. The method signatures are as follows:

  • find_notebook(name) - Find a notebook with given name
  • create_notebook(name) - Create a notebook with given name, which calls Evernote::EDAM::Type::Notebook.new() for you
  • find_or_create_notebook(name) - Search for a notebook by name, and return either that or create a new notebook and return that.

Currently the code is abstracted in an EvernoteUtil class of mine, but I'd be willing to try to patch it back to the sdk. However, I'd like to know if this repo even accepts contributions and if such contributions (adding helper methods not in official API) might be accepted.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

  spec.license = 'MIT'
  # or
  spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Instantating new Oauth client

Hi Guys,

Calling "EvernoteOAuth::Client.new(token: self.evernote_auth_token).note_store"

yields this error:

NoMethodError: undefined method []' for nil:NilClass from /app/vendor/bundle/ruby/2.2.0/gems/evernote_oauth-0.2.3/lib/evernote_oauth/client.rb:18:ininitialize'
from /app/app/models/seller.rb:89:in new' from /app/app/models/seller.rb:89:inconnect_to_evernote_note_store'
from /app/app/models/seller.rb:30:in get_evernote_activator_tag' from /app/app/jobs/process_incoming_evernote_request_job.rb:9:inperform'
from (irb):4
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/console.rb:110:in start' from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/console.rb:9:instart'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:68:in console' from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in <top (required)>' from /app/bin/rails:4:inrequire'
from /app/bin/rails:4:in `

'

Ideas? :-) thanks!

p.s. All works fine in development...

Parallelize the request ?

Hi,

Thanks for you hard work. Is it possible to parallelize the request done with Thrift ?

In my case I want to use getNoteSearchText in parallel in order to gain precious seconds :).

Token of production didn't cause exception when create EvernoteOAuth::Client sandbox

Following code should raise error when token is invalid:

 EvernoteOAuth::Client.new :token => @token

but if the token is a valid one in production environment, which unfortunately is used in sandbox, that doesn't cause any exception. It makes later request failed without proper exception. Actually, it throws an exception like this:

NoMethodError: undefined method `length' for nil:NilClass

I read into evernote-thrift code, found that as the token is invalid, the action(for example, createNote) request would return 302 status without a response body. Next code has no process of this situation, it still create a buffer, but it is empty. Reading an empty buffer causes trouble, but there's no protection neither. See http_client_transport.rb, base_transport.rb

Virtually it may be evernote system's bug , which has no relation with sdk. But the sdk has no good handle of exception.

as it just causes exception in sandbox, it is not that severe.

filter.Words not working while calling noteStore.findNotesMetadata() in c#

NoteFilter filter = new NoteFilter();
filter.Words = "dummy";
NotesMetadataResultSpec spec = new NotesMetadataResultSpec();
spec.IncludeTitle = true;
NotesMetadataList notesList = noteStore.findNotesMetadata(api.AccessToken, filter, 0, pageSize, spec);

But not working.
Please do needfull.

I'm using source code from below repository

https://github.com/evernote/evernote-sdk-csharp/tree/master/src
https://github.com/apache/thrift

::Fixnum deprecated (ruby 2.4.0)

The Fixnum constant is deprecated and should be replaced with Integer in base_protocol.rb.

/Users/prieber/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/evertils-0.3.4/lib/kernel.rb:9: warning: constant ::Fixnum is deprecated
/Users/prieber/.rvm/gems/ruby-2.4.0@global/gems/evernote-thrift-1.25.2/lib/thrift/protocol/base_protocol.rb:254: warning: constant ::Fixnum is deprecated
/Users/prieber/.rvm/gems/ruby-2.4.0@global/gems/evernote-thrift-1.25.2/lib/thrift/protocol/base_protocol.rb:294: warning: constant ::Fixnum is deprecated

HttpClientTransport#flush can call nil.downcase, raise NoMethodError

FYI, in 1.25.1, I'm seeing this line occasionally call nil.downcase because resp.content_type is nil:

resp.content_type.downcase

Manifests as NoMethodError: undefined method 'downcase' for nil:NilClass. I assume these are unsuccessful requests (timeouts, ..), but not so unsuccessful they should raise exceptions outside of the documented set.

SSL certificate verify failed

when i ran the client sample code, i got this error:

/usr/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

I force the http.verify_mode = OpenSSL::SSL::VERIFY_NONE in the http_client_transport.rb file, and this is not a good solution.

EDAMTest.rb throws EDAMUserException on getNoteStoreUrl()

I'm attempting to run EDAMTest.rb. I'm using the code as-is provided from github (except with my api key inserted) on ruby 2.1.3p242 on Windows 8 with evernote-thrift-1.25.1.

I get an Evernote:EDAM:Error:EDAMUserException on the call to getNoteStoreUrl() on line 50.

regression error: findNotesMetadata with any:

When I run a findNotesMetadata with words set to "foo", it works.
However what I need to do is to set words to
any: foo bar
...and have it return notes matching foo or bar
(I don't want foo AND bar (intersection), I want foo OR bar (union), to include either one of the words matched, or both.

This used to work great but lately it does not work as before...I get zero matches returned.
When I use any: keyword in the Evernote app, it works fine.
Please help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.