evernote_oauth 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/evernote_oauth.gemspec +2 -1
- data/lib/evernote_oauth/store_attachable.rb +7 -4
- data/lib/evernote_oauth/version.rb +1 -1
- data/spec/evernote_oauth/business_note_store_spec.rb +1 -1
- data/spec/evernote_oauth/business_utils_spec.rb +6 -6
- data/spec/evernote_oauth/client_spec.rb +5 -5
- data/spec/evernote_oauth/note_store_spec.rb +1 -1
- data/spec/evernote_oauth/shared_note_store_spec.rb +1 -1
- data/spec/evernote_oauth/store_attachable_spec.rb +39 -0
- data/spec/evernote_oauth/user_store_spec.rb +1 -1
- metadata +6 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 32ed5024b913d9d009911f1424c8eb659ddf609f
         | 
| 4 | 
            +
              data.tar.gz: 2a7670b90c7ce9ab05576c37724ff35783d3f4dd
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 25383879ba63e52ea2ccabf414dc0de8b714d822bd8ac03dd41dea8f9e378b11404a9d0ba25bf6b06b58827dd2e0d5c4e4febf77451451042a3f4a1c46e214ce
         | 
| 7 | 
            +
              data.tar.gz: d33a4f9d26d5a9e4991335ba7d135d32eb5a091a9d8e0ed09d5e388093c31ac24c2d45071e5204b8349fd3f115c0583eb648f8824807ba18d56e5bc88f26009d
         | 
    
        data/LICENSE
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            /*
         | 
| 2 | 
            -
             * Copyright (c) 2007- | 
| 2 | 
            +
             * Copyright (c) 2007-2014 by Evernote Corporation, All rights reserved.
         | 
| 3 3 | 
             
             *
         | 
| 4 4 | 
             
             * Use of the source code and binary libraries included in this package
         | 
| 5 5 | 
             
             * is permitted under the following terms:
         | 
    
        data/evernote_oauth.gemspec
    CHANGED
    
    | @@ -10,6 +10,7 @@ Gem::Specification.new do |s| | |
| 10 10 |  | 
| 11 11 | 
             
              s.authors = ["Evernote"]
         | 
| 12 12 | 
             
              s.date = Time.now.strftime('%Y-%m-%d')
         | 
| 13 | 
            +
              s.licenses = ['BSD 2-Clause']
         | 
| 13 14 | 
             
              s.description = %q{evernote_oauth is a Ruby client for the Evernote API using OAuth and Thrift.}
         | 
| 14 15 | 
             
              s.email = %q{api@evernote.com}
         | 
| 15 16 | 
             
              s.files = ["LICENSE", "README.md", "evernote_oauth.gemspec"] + Dir.glob('{lib,spec}/**/*')
         | 
| @@ -19,7 +20,7 @@ Gem::Specification.new do |s| | |
| 19 20 | 
             
              s.require_paths = ["lib"]
         | 
| 20 21 | 
             
              s.rubyforge_project = %q{evernote_oauth}
         | 
| 21 22 | 
             
              s.rubygems_version = EvernoteOAuth::VERSION
         | 
| 22 | 
            -
              s.summary = %q{ | 
| 23 | 
            +
              s.summary = %q{Ruby client for the Evernote API using OAuth and Thrift.}
         | 
| 23 24 |  | 
| 24 25 | 
             
              if s.respond_to? :specification_version then
         | 
| 25 26 | 
             
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| @@ -17,10 +17,13 @@ module EvernoteOAuth | |
| 17 17 | 
             
                        instance_variable_get(target) ||
         | 
| 18 18 | 
             
                        begin
         | 
| 19 19 | 
             
                          store_name = "#{type}_store"
         | 
| 20 | 
            -
                           | 
| 21 | 
            -
             | 
| 22 | 
            -
                             | 
| 23 | 
            -
             | 
| 20 | 
            +
                          if respond_to?(store_name.to_sym)
         | 
| 21 | 
            +
                            store = eval(store_name)
         | 
| 22 | 
            +
                            [instance_variable_get(original)].flatten.each{|n|
         | 
| 23 | 
            +
                              n.define_singleton_method(store_name.to_sym){store}
         | 
| 24 | 
            +
                            }
         | 
| 25 | 
            +
                          end
         | 
| 26 | 
            +
                          instance_variable_get(original)
         | 
| 24 27 | 
             
                        end
         | 
| 25 28 | 
             
                      )
         | 
| 26 29 | 
             
                      instance_variable_set(target, with_stores)
         | 
| @@ -11,7 +11,7 @@ describe "EvernoteOAuth::BusinessNoteStore" do | |
| 11 11 | 
             
              end
         | 
| 12 12 | 
             
              context "#method_missing" do
         | 
| 13 13 | 
             
                it "dispatches method" do
         | 
| 14 | 
            -
                  mock_client =  | 
| 14 | 
            +
                  mock_client = double(Object)
         | 
| 15 15 | 
             
                  mock_client.should_receive(:send).with(:call_method, 'args')
         | 
| 16 16 | 
             
                  mock_client.class.should_receive(:instance_method).with(:call_method).and_return{
         | 
| 17 17 | 
             
                    Proc.new {|a| a}
         | 
| @@ -8,7 +8,7 @@ describe "EvernoteOAuth::BusinessUtils" do | |
| 8 8 | 
             
                  note = Evernote::EDAM::Type::Note.new
         | 
| 9 9 | 
             
                  business_notebook = Evernote::EDAM::Type::LinkedNotebook.new
         | 
| 10 10 | 
             
                  shared_notebook = Evernote::EDAM::Type::SharedNotebook.new(notebookGuid: 'notebook_guid')
         | 
| 11 | 
            -
                  shared_note_store =  | 
| 11 | 
            +
                  shared_note_store = double(Object)
         | 
| 12 12 | 
             
                  shared_note_store.stub(:getSharedNotebookByAuth).and_return(shared_notebook)
         | 
| 13 13 | 
             
                  shared_note_store.stub(:createNote).and_return(note)
         | 
| 14 14 | 
             
                  should_receive(:shared_note_store).with(business_notebook).twice.and_return(shared_note_store)
         | 
| @@ -21,7 +21,7 @@ describe "EvernoteOAuth::BusinessUtils" do | |
| 21 21 | 
             
                  ln1 = Evernote::EDAM::Type::LinkedNotebook.new(businessId: 'Evernote')
         | 
| 22 22 | 
             
                  ln2 = Evernote::EDAM::Type::LinkedNotebook.new
         | 
| 23 23 | 
             
                  ln3 = Evernote::EDAM::Type::LinkedNotebook.new(businessId: 'Evernote')
         | 
| 24 | 
            -
                  note_store =  | 
| 24 | 
            +
                  note_store = double(Object)
         | 
| 25 25 | 
             
                  note_store.stub(:listLinkedNotebooks).and_return([ln1, ln2, ln3])
         | 
| 26 26 | 
             
                  should_receive(:note_store).and_return(note_store)
         | 
| 27 27 | 
             
                  list_business_notebooks.should == [ln1, ln3]
         | 
| @@ -38,7 +38,7 @@ describe "EvernoteOAuth::BusinessUtils" do | |
| 38 38 | 
             
                    name: 'name',
         | 
| 39 39 | 
             
                    sharedNotebooks: [shared_notebook]
         | 
| 40 40 | 
             
                  )
         | 
| 41 | 
            -
                  business_note_store =  | 
| 41 | 
            +
                  business_note_store = double(Object)
         | 
| 42 42 | 
             
                  business_note_store.stub(:createNotebook).with(notebook).and_return(business_notebook)
         | 
| 43 43 | 
             
                  should_receive(:business_note_store).twice.and_return(business_note_store)
         | 
| 44 44 |  | 
| @@ -48,7 +48,7 @@ describe "EvernoteOAuth::BusinessUtils" do | |
| 48 48 | 
             
                  )
         | 
| 49 49 | 
             
                  business_note_store.stub(:user).and_return(business_user)
         | 
| 50 50 |  | 
| 51 | 
            -
                  note_store =  | 
| 51 | 
            +
                  note_store = double(Object)
         | 
| 52 52 | 
             
                  note_store.should_receive(:createLinkedNotebook).with(
         | 
| 53 53 | 
             
                    Evernote::EDAM::Type::LinkedNotebook.new(
         | 
| 54 54 | 
             
                      shareKey: 'shareKey',
         | 
| @@ -67,11 +67,11 @@ describe "EvernoteOAuth::BusinessUtils" do | |
| 67 67 | 
             
                it "calls getNotebookWithGuid with business_note_store" do
         | 
| 68 68 | 
             
                  business_notebook = Evernote::EDAM::Type::LinkedNotebook.new
         | 
| 69 69 | 
             
                  shared_notebook = Evernote::EDAM::Type::SharedNotebook.new(notebookGuid: 'notebook_guid')
         | 
| 70 | 
            -
                  shared_note_store =  | 
| 70 | 
            +
                  shared_note_store = double(Object)
         | 
| 71 71 | 
             
                  shared_note_store.stub(:getSharedNotebookByAuth).and_return(shared_notebook)
         | 
| 72 72 | 
             
                  should_receive(:shared_note_store).with(business_notebook).and_return(shared_note_store)
         | 
| 73 73 |  | 
| 74 | 
            -
                  business_note_store =  | 
| 74 | 
            +
                  business_note_store = double(Object)
         | 
| 75 75 | 
             
                  business_note_store.should_receive(:getNotebook).with('notebook_guid')
         | 
| 76 76 | 
             
                  should_receive(:business_note_store).and_return(business_note_store)
         | 
| 77 77 |  | 
| @@ -21,10 +21,10 @@ describe "EvernoteOAuth::Client" do | |
| 21 21 | 
             
              end
         | 
| 22 22 | 
             
              context "#authorize" do
         | 
| 23 23 | 
             
                it "assigns returns access token" do
         | 
| 24 | 
            -
                  mock_access_token =  | 
| 24 | 
            +
                  mock_access_token = double(OAuth::AccessToken)
         | 
| 25 25 | 
             
                  mock_access_token.should_receive(:token).and_return('token')
         | 
| 26 26 | 
             
                  mock_access_token.should_receive(:secret).and_return('secret')
         | 
| 27 | 
            -
                  mock_request_token =  | 
| 27 | 
            +
                  mock_request_token = double(OAuth::RequestToken)
         | 
| 28 28 | 
             
                  mock_request_token.should_receive(:get_access_token).and_return(mock_access_token)
         | 
| 29 29 | 
             
                  OAuth::RequestToken.stub(:new){mock_request_token}
         | 
| 30 30 |  | 
| @@ -33,11 +33,11 @@ describe "EvernoteOAuth::Client" do | |
| 33 33 | 
             
              end
         | 
| 34 34 | 
             
              context "#request_token" do
         | 
| 35 35 | 
             
                it "calls OAuth::Consumer#get_request_token" do
         | 
| 36 | 
            -
                  mock_request_token =  | 
| 37 | 
            -
                  mock_consumer =  | 
| 36 | 
            +
                  mock_request_token = double(OAuth::RequestToken)
         | 
| 37 | 
            +
                  mock_consumer = double(OAuth::Consumer)
         | 
| 38 38 | 
             
                  mock_consumer.should_receive(:options).and_return({})
         | 
| 39 39 | 
             
                  mock_consumer.should_receive(:get_request_token).with({}).and_return(mock_request_token)
         | 
| 40 | 
            -
                  @client. | 
| 40 | 
            +
                  @client.stub(:consumer){mock_consumer}
         | 
| 41 41 | 
             
                  @client.request_token.should == mock_request_token
         | 
| 42 42 | 
             
                end
         | 
| 43 43 | 
             
              end
         | 
| @@ -11,7 +11,7 @@ describe "EvernoteOAuth::NoteStore" do | |
| 11 11 | 
             
              end
         | 
| 12 12 | 
             
              context "#method_missing" do
         | 
| 13 13 | 
             
                it "dispatches method" do
         | 
| 14 | 
            -
                  mock_client =  | 
| 14 | 
            +
                  mock_client = double(Object)
         | 
| 15 15 | 
             
                  mock_client.should_receive(:send).with(:call_method, 'args')
         | 
| 16 16 | 
             
                  mock_client.class.should_receive(:instance_method).with(:call_method).and_return{
         | 
| 17 17 | 
             
                    Proc.new {|a| a}
         | 
| @@ -16,7 +16,7 @@ describe "EvernoteOAuth::SharedNoteStore" do | |
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              context "#method_missing" do
         | 
| 18 18 | 
             
                it "dispatches method" do
         | 
| 19 | 
            -
                  mock_client =  | 
| 19 | 
            +
                  mock_client = double(Object)
         | 
| 20 20 | 
             
                  mock_client.should_receive(:send).with(:call_method, 'args')
         | 
| 21 21 | 
             
                  mock_client.class.should_receive(:instance_method).with(:call_method).and_return{
         | 
| 22 22 | 
             
                    Proc.new {|a| a}
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            require File.join(File.dirname(__FILE__), "/../spec_helper")
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe "EvernoteOAuth::StoreAttachable" do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              context "#attach_user_store" do
         | 
| 6 | 
            +
                it "assigns user_store to a field" do
         | 
| 7 | 
            +
                  class MyObject
         | 
| 8 | 
            +
                    extend EvernoteOAuth::StoreAttachable
         | 
| 9 | 
            +
                    attr_accessor :dummy_field
         | 
| 10 | 
            +
                    attach_user_store :dummy_field
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
                  object = MyObject.new
         | 
| 13 | 
            +
                  object.define_singleton_method(:user_store) do
         | 
| 14 | 
            +
                    :dummy_user_store
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                  object.dummy_field = Object.new
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  object.dummy_field.user_store.should == object.user_store
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              context "#attach_note_store" do
         | 
| 23 | 
            +
                it "assigns note_store to a field" do
         | 
| 24 | 
            +
                  class MyObject
         | 
| 25 | 
            +
                    extend EvernoteOAuth::StoreAttachable
         | 
| 26 | 
            +
                    attr_accessor :dummy_field
         | 
| 27 | 
            +
                    attach_note_store :dummy_field
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
                  object = MyObject.new
         | 
| 30 | 
            +
                  object.define_singleton_method(:note_store) do
         | 
| 31 | 
            +
                    :dummy_note_store
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
                  object.dummy_field = Object.new
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  object.dummy_field.note_store.should == object.note_store
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            end
         | 
| @@ -16,7 +16,7 @@ describe "EvernoteOAuth::UserStore" do | |
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
              context "#method_missing" do
         | 
| 18 18 | 
             
                it "dispatches method" do
         | 
| 19 | 
            -
                  mock_client =  | 
| 19 | 
            +
                  mock_client = double(Object)
         | 
| 20 20 | 
             
                  mock_client.should_receive(:send).with(:call_method, 'args')
         | 
| 21 21 | 
             
                  mock_client.class.should_receive(:instance_method).with(:call_method).and_return{
         | 
| 22 22 | 
             
                    Proc.new {|a| a}
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: evernote_oauth
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Evernote
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-01-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: oauth
         | 
| @@ -116,10 +116,12 @@ files: | |
| 116 116 | 
             
            - spec/evernote_oauth/client_spec.rb
         | 
| 117 117 | 
             
            - spec/evernote_oauth/note_store_spec.rb
         | 
| 118 118 | 
             
            - spec/evernote_oauth/shared_note_store_spec.rb
         | 
| 119 | 
            +
            - spec/evernote_oauth/store_attachable_spec.rb
         | 
| 119 120 | 
             
            - spec/evernote_oauth/user_store_spec.rb
         | 
| 120 121 | 
             
            - spec/spec_helper.rb
         | 
| 121 122 | 
             
            homepage: http://github.com/evernote/evernote-oauth-ruby
         | 
| 122 | 
            -
            licenses: | 
| 123 | 
            +
            licenses:
         | 
| 124 | 
            +
            - BSD 2-Clause
         | 
| 123 125 | 
             
            metadata: {}
         | 
| 124 126 | 
             
            post_install_message: 
         | 
| 125 127 | 
             
            rdoc_options:
         | 
| @@ -142,6 +144,5 @@ rubyforge_project: evernote_oauth | |
| 142 144 | 
             
            rubygems_version: 2.0.3
         | 
| 143 145 | 
             
            signing_key: 
         | 
| 144 146 | 
             
            specification_version: 2
         | 
| 145 | 
            -
            summary:  | 
| 147 | 
            +
            summary: Ruby client for the Evernote API using OAuth and Thrift.
         | 
| 146 148 | 
             
            test_files: []
         | 
| 147 | 
            -
            has_rdoc: false
         |