didww / activeresource-response Goto Github PK
View Code? Open in Web Editor NEW:link: Extensions to ActiveResource library. The simpliest way for REST pagination.
Home Page: https://rubygems.org/gems/activeresource-response
License: MIT License
:link: Extensions to ActiveResource library. The simpliest way for REST pagination.
Home Page: https://rubygems.org/gems/activeresource-response
License: MIT License
Hi!
First of all - thanks for the gem ❤️
I noticed that during tests headers are symbolized (from example: orders.http_response[:x_total]
). That's not the case in development/production environment ( orders.http_response['X-total']
), can you be so kind and explain what's the reason behind this logic? :)
Hi !
Thanks for the great effort you are doing!
I'm trying your gem to access the headers of my ARes objects, I found it working great with find
operations but experiencing problems with get
.
I added add_response_method :http_response
to my ActiveResource::Base class.
Account.find(1).http_response
=> #<Net::HTTPOK 200 OK readbody=true>
Account.find(1).get(:courses).http_response
=> NoMethodError: undefined method `http_response' for #<Array:0x0000012ce8bc00>
Of course, that get
petition works, but it outputs an array of objects.
Any idea of what am I doing wrong?
David
Is it possible to capture this data after a raised response? I have code like this.
user = User.get(:authenticate, login: params[:login], password: params[:password])
# do stuff with successful authentication
rescue ActiveResource::ResourceInvalid => e
# login failed. do stuff
I'm able to read http_response
from user
but not after my rescue
Am I doing something wrong? Thoughts?
(e)
I've found a problem which occurs in the following case:
the active resource response from the server is seen as a fixnum, which does not allow the addition of the http_response method
it fails with a message like this:
TypeError: can't define singleton method "http_response" for Fixnum
my fix, as for now, was adding a begin rescue clause which wraps the addition of the method. I'm not opening a pull request for that, since I think my fix is too brutal
I have noticed that rubygems has a old version of this gem (1.1.1) (https://rubygems.org/gems/activeresource-response) which does not contain commits related to Rails 5 support.
Would it be possible to release a new version of the gem based on current master?
Thanks in advance!
In test environment, using ActiveResource::HttpMock
Failure/Error: Unable to find matching line from backtrace
NameError:
undefined local variable or method to_hash' for #<ActiveResource::Response:0x007fcd6b8003c8> # ./app/controllers/schedules_controller.rb:17:in
create'
I'm using Webmock (not using Httpmock at all) in my specs and receive the following error when I include this gem:
An error occurred in an after hook
ActiveResource::InvalidRequestError: Could not find a response recorded for <GET: /api/v1/merchants/Foo.json?field=safe_url [{"Accept"=>"application/json", "X-Rest-API-Key"=>"key", "Cookie"=>"sessionid=D"}] ()> - Responses recorded are: []
occurred at /.../src/vendor/ruby/2.0.0/gems/activeresource-4.0.0/lib/active_resource/http_mock.rb:239:in `get'
Commenting out the line below fixes this:
https://github.com/Fivell/activeresource-response/blob/master/lib/active_resource_response.rb#L35
Changes made to HttpMock require fix test env but break development:
On create:
ActiveResource::InvalidRequestError - Could not find a response recorded for <GET: /asset/api/v1/asset_categories.json [{"Accept"=>"application/json"}] ()> - Responses recorded are: []:
(gem) activeresource-3.2.12/lib/active_resource/http_mock.rb:239:in get' (gem) activeresource-3.2.12/lib/active_resource/connection.rb:113:in
block in request'
(gem) activesupport-3.2.12/lib/active_support/notifications.rb:123:in block in instrument' (gem) activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in
instrument'
(gem) activesupport-3.2.12/lib/active_support/notifications.rb:123:in instrument' (gem) activeresource-3.2.12/lib/active_resource/connection.rb:110:in
request'
I'm assuming this is due to the changes made in Fivell@d43824f
There's no information about the license being used by this project.
Hi! Could you bump the gemspec and version so this gem supports usage with Rails 7?
Thanks!
Hi! Could you bump the gemspec and version so this gem supports usage with Rails 6?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.