Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Between a _post and a _get, need a fresh client? #107

Open
dblock opened this issue Sep 25, 2016 · 0 comments
Open

Between a _post and a _get, need a fresh client? #107

dblock opened this issue Sep 25, 2016 · 0 comments
Labels

Comments

@dblock
Copy link
Collaborator

dblock commented Sep 25, 2016

See ruby-grape/grape-with-roar#9.

Doesn't work:

require 'hyperclient'

client = Hyperclient.new('http://localhost:9292/api')

3.times do |i|
  client.splines._post(spline: { name: i.to_s, reticulated: [true, false].sample })
end

client.splines.each do |spline|
  puts "spline #{spline.id} #{spline.reticulated ? 'is' : 'is not'} reticulated"
end

client.splines.each(&:_delete)

Works:

require 'hyperclient'

client = Hyperclient.new('http://localhost:9292/api')
3.times do |i|
  client.splines._post(spline: { name: i.to_s, reticulated: [true, false].sample })
end

client = Hyperclient.new('http://localhost:9292/api')
client.splines.each do |spline|
  puts "spline #{spline.id} #{spline.reticulated ? 'is' : 'is not'} reticulated"
end

client = Hyperclient.new('http://localhost:9292/api')
client.splines.each(&:_delete)
@dblock dblock added the bug label Dec 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant