enop 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fa944930a75dae78c4a3c7555fdc0ddec16bc02
4
- data.tar.gz: ba1657c161e1ef665034808cf59de98c9a40a6c2
3
+ metadata.gz: 7c0c8069ace4c20d04e27fe59c67a90d0b158ff9
4
+ data.tar.gz: 684a364607d64f2807296fd0a9b5d4e87b8e82ff
5
5
  SHA512:
6
- metadata.gz: 2ed7565163dfe70302e7ba820e317380f8c7787a3ff7f9f8ba75bfd3de1b8b538e3c43c4d3b6583f00adf40fe97d72f5e6d2d70593c391e97aea91b58bba8e69
7
- data.tar.gz: c0d2b09c2d36844b9a428db743aac9640c7271cd357493bf0b8438c81e840ccb0bebabf1cf49380b563f82d59a3a296deb73510b7c6b26e1608fac4183ac0c95
6
+ metadata.gz: 0cb46c13de37e241b7e5dcfd5937ae2f070077a20f3e5e132ebaa21baa2c39b84add2a579db85295bffe00c8ca296f13d14c9e6122cd5d3f4a0af3b332db6fb7
7
+ data.tar.gz: 479883f3d8a65583d4121d879cbb0fa18fc90e21f8ce823dd19075ded2f2c066c3e3b0eac85fc49b9b3c36d8c6dc7e5dcf1a395c677b467028b5734c6f29e9ff
data/.gitignore CHANGED
@@ -7,3 +7,11 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /dbg/
11
+ /ennblist*.csv
12
+ /ennblist*.txt
13
+ /*.bat
14
+ /config/
15
+ /db/
16
+ /.*#
17
+ /.gitignore
data/exe/enop CHANGED
@@ -7,6 +7,7 @@ dbconfig = Arxutils::Dbutil::DBCONFIG_MYSQL
7
7
  dbconfig = Arxutils::Dbutil::DBCONFIG_SQLITE3
8
8
 
9
9
  token = ARGV[0]
10
+ url = ARGV[1] if ARGV.size > 10
10
11
  hs = {
11
12
  "db_dir" => Arxutils::Dbutil::DB_DIR,
12
13
  "migrate_dir" => Arxutils::Dbutil::MIGRATE_DIR,
@@ -19,7 +20,8 @@ hs = {
19
20
  enop = Enop::Enop.new(
20
21
  token,
21
22
  :db,
22
- hs
23
+ hs,
24
+ url
23
25
  )
24
26
  enop.connect
25
27
  enop.list_notebooks
data/lib/enop/enop.rb CHANGED
@@ -2,17 +2,20 @@
2
2
  require 'evernote-thrift'
3
3
  require 'csv'
4
4
  require 'pp'
5
-
5
+ require 'openssl'
6
6
  require 'forwardable'
7
7
 
8
8
  module Enop
9
9
  class Enop
10
10
  extend Forwardable
11
11
 
12
- def_delegator( :@dbmgr , :add , :db_add)
13
-
14
- def initialize( authToken , kind, hs )
12
+ def_delegator( :@dbmgr , :add , :db_add )
15
13
 
14
+ def initialize( authToken , kind , hs , userStoreUrl = nil )
15
+ # SSL認証を行わないように変更
16
+ OpenSSL::SSL.module_eval{ remove_const(:VERIFY_PEER) }
17
+ OpenSSL::SSL.const_set( :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE )
18
+
16
19
  @stack_hs = {}
17
20
  @nbinfos = {}
18
21
  @notebookinfo = Struct.new("NotebookInfo", :name, :stack, :defaultNotebook, :count , :tags )
@@ -24,18 +27,20 @@ module Enop
24
27
  }
25
28
 
26
29
  evernoteHost = "www.evernote.com"
27
- userStoreUrl = "https://#{evernoteHost}/edam/user"
30
+ userStoreUrl = "https://#{evernoteHost}/edam/user" unless userStoreUrl
31
+ userStoreUrl = "https://www.evernote.com/shard/s18/notestore"
32
+ # userStoreUrl =
28
33
  userStoreTransport = Thrift::HTTPClientTransport.new(userStoreUrl)
29
34
  userStoreProtocol = Thrift::BinaryProtocol.new(userStoreTransport)
30
35
  @userStore = Evernote::EDAM::UserStore::UserStore::Client.new(userStoreProtocol)
31
-
36
+ # Invalid method name : 'checkVersion' が返されるので、とりあえずコメント化
37
+ =begin
32
38
  versionOK = @userStore.checkVersion("Evernote EDAMTest (Ruby)",
33
39
  Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR,
34
40
  Evernote::EDAM::UserStore::EDAM_VERSION_MINOR)
35
41
  puts "Is my Evernote API version up to date? #{versionOK}"
36
- puts
37
42
  exit(1) unless versionOK
38
-
43
+ =end
39
44
  set_output_dest( get_output_filename_base )
40
45
  end
41
46
 
@@ -65,7 +70,6 @@ module Enop
65
70
  # In that case, you don't need to make this call.
66
71
  #noteStoreUrl = userStore.getNoteStoreUrl(authToken)
67
72
  noteStoreUrl = "https://www.evernote.com/shard/s18/notestore"
68
-
69
73
  noteStoreTransport = Thrift::HTTPClientTransport.new(noteStoreUrl)
70
74
  noteStoreProtocol = Thrift::BinaryProtocol.new(noteStoreTransport)
71
75
  @noteStore = Evernote::EDAM::NoteStore::NoteStore::Client.new(noteStoreProtocol)
@@ -77,8 +81,18 @@ module Enop
77
81
 
78
82
  begin
79
83
  notebooks = @noteStore.listNotebooks(@authToken)
84
+ rescue Evernote::EDAM::Error::EDAMUserException => ex
85
+ parameter = ex.parameter
86
+ errorCode = ex.errorCode
87
+ errorText = Evernote::EDAM::Error::EDAMErrorCode::VALUE_MAP[errorCode]
88
+
89
+ puts "Authentication failed (parameter: #{parameter} errorCode: #{errorText})"
90
+
91
+ exit(1)
80
92
  rescue => ex
93
+ puts "@authToken=#{@authToken}"
81
94
  puts "Can't call listNotebooks"
95
+ p ex
82
96
  exit
83
97
  end
84
98
 
data/lib/enop/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Enop
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evernote_oauth
@@ -154,9 +154,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.4.8
157
+ rubygems_version: 2.4.5.1
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: evernote operation.
161
161
  test_files: []
162
- has_rdoc: