evernote-thrift 1.23.1 → 1.23.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 598f16341c7628bd4915e77fad2e712494079c53
4
+ data.tar.gz: 68e45345cd031e0312f0fcd2b5f5fb19085cd326
5
+ SHA512:
6
+ metadata.gz: 4fbef81c02d170fce5b333d3c115e4054eced59c0f0c8f0ff42e9739dab74f434c79b8bff2b30bb52be535b7492cd1cf65435da5cc2fa86aa0b29fd8fbf22d0b
7
+ data.tar.gz: 97f7ee06c86d49a6a35dd273a65fb74c0d4bd1479e5494f1f2f0e1d69b87bad4a5733a6cf33bd06512ca99130dcfbc1661a828e9a315eff114a672ad70da2434
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/evernote-thrift.png)](http://badge.fury.io/rb/evernote-thrift)
2
+
1
3
  Evernote SDK for Ruby
2
4
  =====================
3
5
 
@@ -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 = 1
9
+ rev = 2
10
10
  version = Gem::Version.new("#{majorv}.#{minorv}.#{rev}").version
11
11
 
12
12
  Gem::Specification.new do |s|
@@ -25,4 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.rubyforge_project = %q{evernote-sdk-ruby}
26
26
  s.rubygems_version = version
27
27
  s.summary = %q{This SDK contains wrapper code used to call the Evernote Cloud API from Ruby.}
28
+
29
+ s.add_development_dependency 'rspec'
30
+ s.add_development_dependency 'fakeweb', '~> 1.3.0'
28
31
  end
@@ -18,21 +18,6 @@
18
18
  # under the License.
19
19
  #
20
20
 
21
- @@kJSONObjectStart = '{'
22
- @@kJSONObjectEnd = '}'
23
- @@kJSONArrayStart = '['
24
- @@kJSONArrayEnd = ']'
25
- @@kJSONNewline = '\n'
26
- @@kJSONElemSeparator = ','
27
- @@kJSONPairSeparator = ':'
28
- @@kJSONBackslash = '\\'
29
- @@kJSONStringDelimiter = '"'
30
-
31
- @@kThriftVersion1 = 1
32
-
33
- @@kThriftNan = "NaN"
34
- @@kThriftInfinity = "Infinity"
35
- @@kThriftNegativeInfinity = "-Infinity"
36
21
 
37
22
  module Thrift
38
23
  class LookaheadReader
@@ -66,6 +51,7 @@ module Thrift
66
51
  # implementations
67
52
  #
68
53
  class JSONContext
54
+ @@kJSONElemSeparator = ','
69
55
  #
70
56
  # Write context data to the trans. Default is to do nothing.
71
57
  #
@@ -89,6 +75,8 @@ module Thrift
89
75
 
90
76
  # Context class for object member key-value pairs
91
77
  class JSONPairContext < JSONContext
78
+ @@kJSONPairSeparator = ':'
79
+
92
80
  def initialize
93
81
  @first = true
94
82
  @colon = true
@@ -146,6 +134,21 @@ module Thrift
146
134
  end
147
135
 
148
136
  class JsonProtocol < BaseProtocol
137
+
138
+ @@kJSONObjectStart = '{'
139
+ @@kJSONObjectEnd = '}'
140
+ @@kJSONArrayStart = '['
141
+ @@kJSONArrayEnd = ']'
142
+ @@kJSONNewline = '\n'
143
+ @@kJSONBackslash = '\\'
144
+ @@kJSONStringDelimiter = '"'
145
+
146
+ @@kThriftVersion1 = 1
147
+
148
+ @@kThriftNan = "NaN"
149
+ @@kThriftInfinity = "Infinity"
150
+ @@kThriftNegativeInfinity = "-Infinity"
151
+
149
152
  def initialize(trans)
150
153
  super(trans)
151
154
  @context = JSONContext.new
@@ -29,6 +29,7 @@ module Thrift
29
29
  def initialize(url, proxy_addr = nil, proxy_port = nil)
30
30
  @url = URI url
31
31
  @headers = default_headers
32
+ @ssl_attributes = default_ssl_attributes
32
33
  @outbuf = Bytes.empty_byte_buffer
33
34
  @proxy_addr = proxy_addr
34
35
  @proxy_port = proxy_port
@@ -42,9 +43,18 @@ module Thrift
42
43
  @headers = @headers.merge(headers)
43
44
  end
44
45
 
46
+ # Add ssl attributes for underlying Net::HTTP instance.
47
+ #
48
+ # attributes - Hash of Symbols to values where keys correspond to ssl
49
+ # attributes of Net::HTTP like ca_file, verify_mode, etc.
50
+ def add_ssl_attributes(attributes)
51
+ @ssl_attributes = @ssl_attributes.merge(attributes)
52
+ end
53
+
45
54
  def flush
46
55
  http = Net::HTTP.new @url.host, @url.port, @proxy_addr, @proxy_port
47
- http.use_ssl = @url.scheme == "https"
56
+ apply_ssl_attributes(http) if @url.scheme == "https"
57
+
48
58
  resp = http.post(@url.request_uri, @outbuf, @headers)
49
59
  data = resp.body
50
60
  data = Bytes.force_binary_encoding(data)
@@ -53,11 +63,22 @@ module Thrift
53
63
  end
54
64
 
55
65
  private
66
+
56
67
  def default_headers
57
68
  sdk_version = "#{Evernote::EDAM::UserStore::EDAM_VERSION_MAJOR}.#{Evernote::EDAM::UserStore::EDAM_VERSION_MINOR}" rescue 'NA'
58
69
  {'Content-Type' => 'application/x-thrift',
59
70
  'User-Agent' => "Evernote SDK Ruby / #{sdk_version}; Ruby / #{RUBY_VERSION};"}
60
71
  end
61
72
 
73
+ def default_ssl_attributes
74
+ {:use_ssl => true,
75
+ :verify_mode => OpenSSL::SSL::VERIFY_PEER}
76
+ end
77
+
78
+ def apply_ssl_attributes(http)
79
+ @ssl_attributes.each do |k, v|
80
+ http.__send__("#{k}=", v)
81
+ end
82
+ end
62
83
  end
63
84
  end
metadata CHANGED
@@ -1,16 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evernote-thrift
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.1
5
- prerelease:
4
+ version: 1.23.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Evernote
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-11 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2013-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fakeweb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.0
14
41
  description: This SDK contains wrapper code used to call the Evernote Cloud API from
15
42
  Ruby.
16
43
  email: api@evernote.com
@@ -74,6 +101,7 @@ files:
74
101
  - lib/thrift.rb
75
102
  homepage: http://github.com/evernote/evernote-sdk-ruby
76
103
  licenses: []
104
+ metadata: {}
77
105
  post_install_message:
78
106
  rdoc_options:
79
107
  - --inline-source
@@ -81,21 +109,19 @@ rdoc_options:
81
109
  require_paths:
82
110
  - lib
83
111
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
112
  requirements:
86
- - - ! '>='
113
+ - - '>='
87
114
  - !ruby/object:Gem::Version
88
115
  version: '0'
89
116
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
117
  requirements:
92
- - - ! '>='
118
+ - - '>='
93
119
  - !ruby/object:Gem::Version
94
120
  version: '0'
95
121
  requirements: []
96
122
  rubyforge_project: evernote-sdk-ruby
97
- rubygems_version: 1.8.24
123
+ rubygems_version: 2.0.3
98
124
  signing_key:
99
- specification_version: 3
125
+ specification_version: 4
100
126
  summary: This SDK contains wrapper code used to call the Evernote Cloud API from Ruby.
101
127
  test_files: []