rest-core 3.5.91 → 3.5.92

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: 823765dcee8e3fa85b0e8096f2e997c77cad2ae8
4
- data.tar.gz: dc1c4f855db3fbc5f5992f5687856fec9f9dd634
3
+ metadata.gz: 71fc71379386c45f55e01051b376bf514a1075c7
4
+ data.tar.gz: f928e5b82c9a3f1363b63f26ab44ced207bb9eed
5
5
  SHA512:
6
- metadata.gz: e70448f54bc1c88cf4f0f23aabf33047e1a1933afaf4bd7ced8834a60bff534bcda3c8e22f4767dd7ba3c1fa4d2d3b4b264b8a2fae76fcb1bede0560a1ef96ab
7
- data.tar.gz: 2eb633858286455a07c511caddb43e235c5721d694e2b2b6fd9237066e1fc225b14796f41484bc2c02d857d6cf2a86c3225ba2c8cf11bfd0e2bec861ef378fdf
6
+ metadata.gz: 5d381aac49625af92235bd160607220756cd596f8ffdcabc9a90512185564e65e3a4356a0650227e9b6aa5edacedd6b0b3cf4cfdf0883adca4fb48be38f00d6a
7
+ data.tar.gz: bfa47194947c204e83e027d3311ec950ec35a5a7417f727317120844908ebab2c3f32bfc1caa212d7f483aa5682ace607c0e580159fde3020c32cd7c889a5ddb
@@ -1,9 +1,9 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.0
5
4
  - 2.1
6
5
  - 2.2
6
+ - 2.3.0
7
7
  - rbx
8
8
  - jruby-9
9
9
 
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGES
2
2
 
3
+ ## rest-core 3.5.92 -- 2015-12-28
4
+
5
+ ### Enhancements
6
+
7
+ * Added `RestCore::DalliExtension` for making `Dalli::Client` walk and quad
8
+ like `Hash` so that you could pass it as a cache client to
9
+ `RestCore::Cache`.
10
+
3
11
  ## rest-core 3.5.91 -- 2015-12-11
4
12
 
5
13
  ### Bugs fixed
@@ -45,6 +45,7 @@ module RestCore
45
45
  autoload :Config , 'rest-core/util/config'
46
46
  autoload :Clash , 'rest-core/util/clash'
47
47
  autoload :Smash , 'rest-core/util/smash'
48
+ autoload :DalliExtension, 'rest-core/util/dalli_extension'
48
49
 
49
50
  # middlewares
50
51
  autoload :AuthBasic , 'rest-core/middleware/auth_basic'
@@ -0,0 +1,15 @@
1
+
2
+ module RestCore; end
3
+ module RestCore::DalliExtension
4
+ def [] *args
5
+ get(*args)
6
+ end
7
+
8
+ def []= *args
9
+ set(*args)
10
+ end
11
+
12
+ def store key, value, expires_in: nil
13
+ set(key, value, expires_in)
14
+ end
15
+ end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module RestCore
3
- VERSION = '3.5.91'
3
+ VERSION = '3.5.92'
4
4
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rest-core 3.5.91 ruby lib
2
+ # stub: rest-core 3.5.92 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rest-core"
6
- s.version = "3.5.91"
6
+ s.version = "3.5.92"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Lin Jen-Shin (godfat)"]
11
- s.date = "2015-12-11"
11
+ s.date = "2015-12-28"
12
12
  s.description = "Modular Ruby clients interface for REST APIs.\n\nThere has been an explosion in the number of REST APIs available today.\nTo address the need for a way to access these APIs easily and elegantly,\nwe have developed rest-core, which consists of composable middleware\nthat allows you to build a REST client for any REST API. Or in the case of\ncommon APIs such as Facebook, Github, and Twitter, you can simply use the\ndedicated clients provided by [rest-more][].\n\n[rest-more]: https://github.com/godfat/rest-more"
13
13
  s.email = ["godfat (XD) godfat.org"]
14
14
  s.files = [
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
66
66
  "lib/rest-core/timer.rb",
67
67
  "lib/rest-core/util/clash.rb",
68
68
  "lib/rest-core/util/config.rb",
69
+ "lib/rest-core/util/dalli_extension.rb",
69
70
  "lib/rest-core/util/hmac.rb",
70
71
  "lib/rest-core/util/json.rb",
71
72
  "lib/rest-core/util/parse_link.rb",
@@ -85,6 +86,7 @@ Gem::Specification.new do |s|
85
86
  "test/test_client.rb",
86
87
  "test/test_client_oauth1.rb",
87
88
  "test/test_config.rb",
89
+ "test/test_dalli_extension.rb",
88
90
  "test/test_default_headers.rb",
89
91
  "test/test_default_payload.rb",
90
92
  "test/test_default_query.rb",
@@ -113,7 +115,7 @@ Gem::Specification.new do |s|
113
115
  "test/test_universal.rb"]
114
116
  s.homepage = "https://github.com/godfat/rest-core"
115
117
  s.licenses = ["Apache License 2.0"]
116
- s.rubygems_version = "2.5.0"
118
+ s.rubygems_version = "2.5.1"
117
119
  s.summary = "Modular Ruby clients interface for REST APIs."
118
120
  s.test_files = [
119
121
  "test/test_auth_basic.rb",
@@ -124,6 +126,7 @@ Gem::Specification.new do |s|
124
126
  "test/test_client.rb",
125
127
  "test/test_client_oauth1.rb",
126
128
  "test/test_config.rb",
129
+ "test/test_dalli_extension.rb",
127
130
  "test/test_default_headers.rb",
128
131
  "test/test_default_payload.rb",
129
132
  "test/test_default_query.rb",
@@ -0,0 +1,41 @@
1
+
2
+ require 'rest-core/test'
3
+
4
+ describe RC::DalliExtension do
5
+ after do
6
+ Muack.verify
7
+ end
8
+
9
+ def engine env
10
+ yield(env.merge(RC::RESPONSE_STATUS => 200,
11
+ RC::RESPONSE_HEADERS => {'A' => 'B'},
12
+ RC::RESPONSE_BODY => 'ok'))
13
+ end
14
+
15
+ def call dalli, opts={}, &block
16
+ dalli.extend(RC::DalliExtension)
17
+ RC::Cache.new(method(:engine), dalli, 10).
18
+ call({RC::REQUEST_METHOD => :get,
19
+ RC::REQUEST_HEADERS => {}}.merge(opts),
20
+ &lambda{|_|_})[RC::RESPONSE_BODY]
21
+ end
22
+
23
+ would 'set and get' do
24
+ dalli = Object.new
25
+ mock(dalli).set(is_a(String), nil) do |key, value|
26
+ mock(dalli).get(key){ "200\nA: B\n\n\nok" }
27
+ end
28
+
29
+ expect(call(dalli, 'cache.update' => true)).eq 'ok'
30
+ end
31
+
32
+ would 'store' do
33
+ dalli = Object.new
34
+ mock(dalli).get(is_a(String)) do |key|
35
+ mock(dalli).set(key, "200\nA: B\n\n\nok", 10){}
36
+ nil
37
+ end
38
+
39
+ expect(call(dalli)).eq 'ok'
40
+ end
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.91
4
+ version: 3.5.92
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -123,6 +123,7 @@ files:
123
123
  - lib/rest-core/timer.rb
124
124
  - lib/rest-core/util/clash.rb
125
125
  - lib/rest-core/util/config.rb
126
+ - lib/rest-core/util/dalli_extension.rb
126
127
  - lib/rest-core/util/hmac.rb
127
128
  - lib/rest-core/util/json.rb
128
129
  - lib/rest-core/util/parse_link.rb
@@ -142,6 +143,7 @@ files:
142
143
  - test/test_client.rb
143
144
  - test/test_client_oauth1.rb
144
145
  - test/test_config.rb
146
+ - test/test_dalli_extension.rb
145
147
  - test/test_default_headers.rb
146
148
  - test/test_default_payload.rb
147
149
  - test/test_default_query.rb
@@ -188,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
190
  version: '0'
189
191
  requirements: []
190
192
  rubyforge_project:
191
- rubygems_version: 2.5.0
193
+ rubygems_version: 2.5.1
192
194
  signing_key:
193
195
  specification_version: 4
194
196
  summary: Modular Ruby clients interface for REST APIs.
@@ -201,6 +203,7 @@ test_files:
201
203
  - test/test_client.rb
202
204
  - test/test_client_oauth1.rb
203
205
  - test/test_config.rb
206
+ - test/test_dalli_extension.rb
204
207
  - test/test_default_headers.rb
205
208
  - test/test_default_payload.rb
206
209
  - test/test_default_query.rb