Giter VIP home page Giter VIP logo

activeresource-response's People

Contributors

amasses avatar fivell avatar killthekitten avatar saten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activeresource-response's Issues

Symbolized headers during tests

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? :)

:find method working but problems with :get

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

Retrieving extra data after a 4XX or 5XX response

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)

problem with fixnums

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

to_hash doesn't exist in HttpResponse

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:increate'

Broken with webmock

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

0.5.2 breaks development env

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:inblock 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:ininstrument'
(gem) activesupport-3.2.12/lib/active_support/notifications.rb:123:in instrument' (gem) activeresource-3.2.12/lib/active_resource/connection.rb:110:inrequest'

I'm assuming this is due to the changes made in Fivell@d43824f

Rails 7 support

Hi! Could you bump the gemspec and version so this gem supports usage with Rails 7?
Thanks!

Rails 6 Support

Hi! Could you bump the gemspec and version so this gem supports usage with Rails 6?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.