rest-more 3.3.2 → 3.3.3

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: 98ac71864d29ae971e6089b3e162f0a15a69d277
4
- data.tar.gz: 4dcf5ff68b60bcc92cef303ff8ca94e68feb9697
3
+ metadata.gz: 32c5362d391691b06bfb77244d5e676d9c72264e
4
+ data.tar.gz: c8150b6a7c9a2f26ec9104f41f2e30e68077c0be
5
5
  SHA512:
6
- metadata.gz: fda0e5a602f1105e6ce465915789df10198d8f91a20ded059541a9297da0cbdcd3cdfa93766406914fb70cb726b44cb73d820507533332be968e1497089e176f
7
- data.tar.gz: 6847bb6f40a0a68db98b97147d32dadbc32cc1058491f7631d33df051068eb0495fc91c9bacaaf97c8c16585c01926440b705c0c1f9679f75ed01dbd18318a78
6
+ metadata.gz: be08c056e98bc4534749886286390f999d88ae45929bf68025eb082183672278df8780c5fb1513daa178a1c8b4ee6d9d367088863fa17199fe81376f52f76867
7
+ data.tar.gz: 011e7d20ab8e6fe521e3b3c69abd4b357cb918017e41c75bb23dfcb848b698f5f4ff5f8de3107c122dbb8def8b81abe8f97d0236cba11a078d6d6c58d64fb1c5
@@ -13,3 +13,8 @@ script: 'ruby -r bundler/setup -S rake test:travis'
13
13
  env:
14
14
  - 'RESTMORE=rest-more'
15
15
  - 'RESTMORE=rails3'
16
+
17
+ matrix:
18
+ allow_failures:
19
+ - rvm: 2.2
20
+ env: 'RESTMORE=rails3'
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGES
2
2
 
3
+ ## rest-more 3.3.3 -- 2015-02-26
4
+
5
+ * Try to adopt StackExchange's inconsistency
6
+
3
7
  ## rest-more 3.3.2 -- 2015-01-05
4
8
 
5
9
  * Added RC::StackExchange#authorized?
data/Gemfile CHANGED
@@ -40,4 +40,4 @@ platforms :jruby do
40
40
  gem 'jruby-openssl'
41
41
  end
42
42
 
43
- gem 'rails', '3.2.16' if ENV['RESTMORE'] == 'rails3'
43
+ gem 'rails', '~> 3.2.16' if ENV['RESTMORE'] == 'rails3'
data/README.md CHANGED
@@ -4,10 +4,11 @@ by Lin Jen-Shin ([godfat](http://godfat.org))
4
4
 
5
5
  Lin Jen-Shin ([godfat][]) had given a talk about rest-core on
6
6
  [RubyConf Taiwan 2011][talk]. The slide is in English, but the
7
- talk is in Mandarin.
7
+ talk is in Mandarin. There's another talk about [The Promise of rest-core][]
8
8
 
9
9
  [godfat]: https://github.com/godfat
10
10
  [talk]: http://rubyconf.tw/2011/#6
11
+ [The Promise of rest-core]: http://godfat.org/slide/2015-01-13-rest-core-promise/
11
12
 
12
13
  ## LINKS:
13
14
 
@@ -51,10 +52,12 @@ Other clients in other gems:
51
52
  * Firebase: [rest-firebase][]
52
53
  * TopCoder: [topcoder][]
53
54
  * YahooBuy: [rest-more-yahoo_buy][]
55
+ * Scrapyd: [rest-scrapyd][]
54
56
 
55
57
  [rest-firebase]: https://github.com/CodementorIO/rest-firebase
56
58
  [topcoder]: https://github.com/miaout17/topcoder
57
59
  [rest-more-yahoo_buy]: https://github.com/GoodLife/rest-more-yahoo_buy
60
+ [rest-scrapyd]: https://github.com/wvengen/rest-scrapyd
58
61
 
59
62
  ## REQUIREMENTS:
60
63
 
@@ -61,13 +61,14 @@ module RestCore::Github::Client
61
61
 
62
62
  def all path, query={}, opts={}
63
63
  q = {:per_page => MAX_PER_PAGE}.merge(query)
64
- r = get(path, q, opts.merge(RESPONSE_KEY => PROMISE)).then{ |response|
65
- body = response[RESPONSE_BODY] + page_range(response).map{ |page|
66
- get(path, q.merge(:page => page),
67
- opts.merge(RESPONSE_KEY => RESPONSE_BODY))
68
- }.inject([], &:+)
69
- response.merge(RESPONSE_BODY => body)
70
- }.future_response
64
+ r = get(path, q, opts.merge(RESPONSE_KEY => PROMISE, ASYNC => true)).
65
+ then{ |response|
66
+ body = response[RESPONSE_BODY] + page_range(response).map{ |page|
67
+ get(path, q.merge(:page => page),
68
+ opts.merge(RESPONSE_KEY => RESPONSE_BODY))
69
+ }.inject([], &:+)
70
+ response.merge(RESPONSE_BODY => body)
71
+ }.future_response
71
72
 
72
73
  if block_given?
73
74
  yield(r[response_key(opts)])
@@ -13,7 +13,20 @@ module RestCore
13
13
 
14
14
  use CommonLogger , nil
15
15
  use ErrorHandler , lambda{ |env|
16
- RuntimeError.new(env[RESPONSE_BODY]['error_message'])}
16
+ body = case env[RESPONSE_BODY]
17
+ when Hash # regular api failure
18
+ env[RESPONSE_BODY]
19
+ when String # authorization failure
20
+ Json.decode(env[RESPONSE_BODY])
21
+ else # impossible
22
+ RuntimeError.new("What's this? #{env[RESPONSE_BODY]}")
23
+ end
24
+ # https://api.stackexchange.com/docs/error-handling
25
+ # not sure where to look at the true error message, so search for it
26
+ RuntimeError.new(body['error_message'] ||
27
+ body['error_description'] ||
28
+ (body['error'] && body['error']['message']))
29
+ }
17
30
  use ErrorDetectorHttp
18
31
  use JsonResponse , true
19
32
  use Cache , nil, 600
@@ -1,4 +1,4 @@
1
1
 
2
2
  module RestMore
3
- VERSION = '3.3.2'
3
+ VERSION = '3.3.3'
4
4
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rest-more 3.3.2 ruby lib
2
+ # stub: rest-more 3.3.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rest-more"
6
- s.version = "3.3.2"
6
+ s.version = "3.3.3"
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-01-05"
11
+ s.date = "2015-02-26"
12
12
  s.description = "Various REST clients such as Facebook and Twitter built with [rest-core][].\n\n[rest-core]: https://github.com/godfat/rest-core"
13
13
  s.email = ["godfat (XD) godfat.org"]
14
14
  s.executables = ["rib-rest-core"]
@@ -83,7 +83,7 @@ Gem::Specification.new do |s|
83
83
  "test/twitter/test_twitter.rb"]
84
84
  s.homepage = "https://github.com/godfat/rest-more"
85
85
  s.licenses = ["Apache License 2.0"]
86
- s.rubygems_version = "2.4.5"
86
+ s.rubygems_version = "2.4.6"
87
87
  s.summary = "Various REST clients such as Facebook and Twitter built with [rest-core][]."
88
88
  s.test_files = [
89
89
  "test/dropbox/test_dropbox.rb",
@@ -100,8 +100,12 @@ module Gemgem
100
100
  if ENV['COV'] || ENV['CI']
101
101
  require 'simplecov'
102
102
  if ENV['CI']
103
- require 'coveralls'
104
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
103
+ begin
104
+ require 'coveralls'
105
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
106
+ rescue LoadError => e
107
+ puts "Cannot load coveralls, skip: #{e}"
108
+ end
105
109
  end
106
110
  SimpleCov.start do
107
111
  add_filter('test/')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-more
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.3.3
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-01-05 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-core
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.4.5
126
+ rubygems_version: 2.4.6
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Various REST clients such as Facebook and Twitter built with [rest-core][].