evernote-thrift 1.22.1 → 1.22.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/evernote-thrift.gemspec +1 -1
- data/lib/thrift.rb +15 -0
- data/lib/thrift/transport/http_client_transport.rb +9 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -46,3 +46,10 @@ There are two pages in the sample. evernote_oauth.rb demonstrates each step of t
|
|
46
46
|
ruby -rubygems evernote_oauth.rb
|
47
47
|
6. Open the sample app in your browser: http://localhost:4567
|
48
48
|
7. Repeat steps 5 and 6 with the file evernote_oauth_simple.rb to run the simple sample app.
|
49
|
+
|
50
|
+
Getting Started - evernote_oauth gem
|
51
|
+
------------------------------------
|
52
|
+
We also provide a high level wrapper for the Thrift API client. You can install it with:
|
53
|
+
gem install evernote_oauth
|
54
|
+
|
55
|
+
For more detail, see: https://github.com/evernote/evernote-oauth-ruby
|
data/evernote-thrift.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'evernote-thrift'
|
|
6
6
|
|
7
7
|
majorv = Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR
|
8
8
|
minorv = Evernote::EDAM::UserStore::EDAM_VERSION_MINOR
|
9
|
-
rev =
|
9
|
+
rev = 2
|
10
10
|
version = Gem::Version.new("#{majorv}.#{minorv}.#{rev}").version
|
11
11
|
|
12
12
|
Gem::Specification.new do |s|
|
data/lib/thrift.rb
CHANGED
@@ -54,3 +54,18 @@ require 'thrift/transport/http_client_transport'
|
|
54
54
|
require 'thrift/transport/io_stream_transport'
|
55
55
|
require 'thrift/transport/memory_buffer_transport'
|
56
56
|
|
57
|
+
# user-agent for rubygem
|
58
|
+
module Thrift
|
59
|
+
class HTTPClientTransport < BaseTransport
|
60
|
+
private
|
61
|
+
alias_method :original_default_headers, :default_headers
|
62
|
+
def default_headers
|
63
|
+
gem_version = Gem.loaded_specs['evernote-thrift'].version.to_s
|
64
|
+
{'Content-Type' => 'application/x-thrift',
|
65
|
+
'User-Agent' => "evernote-thrift gem / #{gem_version}; Ruby / #{RUBY_VERSION};"}
|
66
|
+
rescue
|
67
|
+
original_default_headers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -28,7 +28,7 @@ module Thrift
|
|
28
28
|
|
29
29
|
def initialize(url, proxy_addr = nil, proxy_port = nil)
|
30
30
|
@url = URI url
|
31
|
-
@headers =
|
31
|
+
@headers = default_headers
|
32
32
|
@outbuf = ""
|
33
33
|
@proxy_addr = proxy_addr
|
34
34
|
@proxy_port = proxy_port
|
@@ -49,5 +49,13 @@ module Thrift
|
|
49
49
|
@inbuf = StringIO.new resp.body
|
50
50
|
@outbuf = ""
|
51
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def default_headers
|
55
|
+
sdk_version = "#{Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR}.#{Evernote::EDAM::UserStore::EDAM_VERSION_MINOR}" rescue 'NA'
|
56
|
+
{'Content-Type' => 'application/x-thrift',
|
57
|
+
'User-Agent' => "Evernote SDK Ruby / #{sdk_version}; Ruby / #{RUBY_VERSION};"}
|
58
|
+
end
|
59
|
+
|
52
60
|
end
|
53
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evernote-thrift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.22.
|
4
|
+
version: 1.22.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This SDK contains wrapper code used to call the Evernote Cloud API from
|
15
15
|
Ruby.
|