Skip to content

Commit bd02a31

Browse files
committed
Removed Futuroscope.
1 parent 362a9dd commit bd02a31

12 files changed

+27
-247
lines changed

.rubocop_todo.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2017-10-01 22:20:54 +0300 using RuboCop version 0.50.0.
3+
# on 2018-01-05 16:54:58 -0500 using RuboCop version 0.50.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -9,23 +9,23 @@
99
# Offense count: 1
1010
# Configuration parameters: CountComments.
1111
Metrics/ClassLength:
12-
Max: 110
12+
Max: 103
1313

14-
# Offense count: 97
14+
# Offense count: 94
1515
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
1616
# URISchemes: http, https
1717
Metrics/LineLength:
1818
Max: 142
1919

20-
# Offense count: 4
20+
# Offense count: 3
2121
# Configuration parameters: CountComments.
2222
Metrics/MethodLength:
2323
Max: 25
2424

2525
# Offense count: 3
2626
# Configuration parameters: CountComments.
2727
Metrics/ModuleLength:
28-
Max: 398
28+
Max: 265
2929

3030
# Offense count: 2
3131
# Configuration parameters: EnforcedStyle, SupportedStyles.

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
### 0.8.7 (Next)
1+
### 0.9.0 (Next)
22

3+
* [#133](https://github.com/codegram/hyperclient/pull/133): Removed futuroscope - [@dblock](https://github.com/dblock).
34
* [#131](https://github.com/codegram/hyperclient/pull/131): Upgrade to Rubocop 0.50.0, fix Bundler's insecure git source warning - [@nebolsin](https://github.com/nebolsin).
45
* [#132](https://github.com/codegram/hyperclient/pull/132): Swapped yard dependency for danger-toc - [@dblock](https://github.com/dblock).
56
* Your contribution here.

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ end
2323
group :test do
2424
gem 'danger-changelog', '~> 0.1'
2525
gem 'danger-toc', '~> 0.1'
26-
gem 'futuroscope', github: 'codegram/futuroscope'
2726
gem 'minitest'
2827
gem 'mocha'
2928
gem 'rack-test'

README.md

-18
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Hyperclient is a Hypermedia API client written in Ruby. It fully supports [JSON
1818
- [Curies](#curies)
1919
- [Attributes](#attributes)
2020
- [HTTP](#http)
21-
- [Asynchronous requests](#asynchronous-requests)
2221
- [Testing Using Hyperclient](#testing-using-hyperclient)
2322
- [Reference](#reference)
2423
- [Hyperclient Users](#hyperclient-users)
@@ -204,23 +203,6 @@ spline._delete
204203

205204
HTTP methods always return a new instance of Resource.
206205

207-
## Asynchronous requests
208-
209-
By default, Hyperclient requests are performed asynchronously in a background thread pool via the [Futuroscope](https://github.com/codegram/futuroscope) gem. You can control the size of this pool by setting the `min_workers` and `max_workers` settings:
210-
211-
```ruby
212-
Futuroscope.default_pool.min_workers = 10
213-
Futuroscope.default_pool.max_workers = 20
214-
```
215-
216-
If you want to disable this behavior and have all requests performed synchronously, you can use the client `options` to disable this behavior:
217-
218-
```ruby
219-
api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
220-
client.options[:async] = false
221-
end
222-
```
223-
224206
# Testing Using Hyperclient
225207

226208
You can combine RSpec, Faraday::Adapter::Rack and Hyperclient to test your HAL API without having to ever examine the raw JSON response.

UPGRADING.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
Upgrading Hyperclient
22
=====================
33

4+
### Upgrading to >= 0.9.0
5+
6+
Previous versions of Hyperclient performed asynchronous requests using [futuroscope](https://github.com/codegram/futuroscope) by default, which could be disabled by providing the `:async` option to each Hyperclient instance. This has been removed and you can remove any such code.
7+
8+
```ruby
9+
api = Hyperclient.new('https://grape-with-roar.herokuapp.com/api') do |client|
10+
client.options[:async] = false
11+
end
12+
```
13+
14+
The default new behavior is synchronous. We recommend [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby) for your asynchronous needs.
15+
16+
Include [futuroscope](https://github.com/codegram/futuroscope) in your `Gemfile` and wrap Hyperclient requests into `Futuroscope::Future.new` blocks to get the old behavior.
17+
18+
See [#133](https://github.com/codegram/hyperclient/pull/133) and [#123](https://github.com/codegram/hyperclient/issues/123) for more information.
19+
420
### Upgrading to >= 0.8.0
521

622
### Changes in curies

hyperclient.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Gem::Specification.new do |gem|
1515
gem.version = Hyperclient::VERSION
1616

1717
gem.add_dependency 'faraday', '>= 0.9.0'
18-
gem.add_dependency 'futuroscope'
1918
gem.add_dependency 'faraday_middleware'
2019
gem.add_dependency 'faraday_hal_middleware'
2120
gem.add_dependency 'uri_template'

lib/hyperclient/entry_point.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EntryPoint < Link
3838
def initialize(url, &_block)
3939
@link = { 'href' => url }
4040
@entry_point = self
41-
@options = { async: true }
41+
@options = {}
4242
@connection = nil
4343
@resource = nil
4444
@key = nil
@@ -118,9 +118,7 @@ def faraday_block=(value)
118118

119119
# Public: Read/Set options.
120120
#
121-
# value - A Hash containing the client options. Use { async: false } to
122-
# to disable the default behavior of performing requests asynchronously
123-
# using futures.
121+
# value - A Hash containing the client options.
124122
attr_accessor :options
125123

126124
private

lib/hyperclient/link.rb

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'uri_template'
2-
require 'futuroscope'
32

43
module Hyperclient
54
# Internal: The Link is used to let a Resource interact with the API.
@@ -168,15 +167,7 @@ def _uri_template
168167

169168
def http_method(method, body = nil)
170169
@resource = begin
171-
response =
172-
if @entry_point.options[:async]
173-
Futuroscope::Future.new do
174-
@entry_point.connection.run_request(method, _url, body, nil)
175-
end
176-
else
177-
@entry_point.connection.run_request(method, _url, body, nil)
178-
end
179-
170+
response = @entry_point.connection.run_request(method, _url, body, nil)
180171
Resource.new(response.body, @entry_point, response)
181172
end
182173
end

lib/hyperclient/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Hyperclient
2-
VERSION = '0.8.7'.freeze
2+
VERSION = '0.9.0'.freeze
33
end

test/hyperclient/entry_point_test.rb

-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ module Hyperclient
5959
entry_point._url.must_equal 'http://my.api.org'
6060
end
6161
end
62-
63-
describe 'options' do
64-
it 'enables the async option by default' do
65-
entry_point.options[:async].must_equal true
66-
end
67-
end
6862
end
6963

7064
describe 'faraday_options' do

0 commit comments

Comments
 (0)