17 April 2014

The Ruby Reflector

Topic

Response

  Source Favicon
By Patrick Reagan of Viget.com Blogs over 1 year ago.
Email

def response @ response ||= begin status, headers, body = @application.call(request.env) Rack::Response.new(body, status, headers) end end end end end

The key change here is that by introducing the Mobile::Format::Responder class that encapsulates environment , I can more easily perform an extract method refactoring and improve the readability of this code. Additionally, each time that this middleware is invoked, I'm guaranteed to have …

viget.com Read
  Source Favicon
By Satish Talim of RubyLearning Blog 4 months ago.
Email

Optional: Request and Response with Saral

Optional: Rack Middleware with Saral

Rendering Views

Exercise 8 - Street View modified

Exercise 9 - Saral Web Service: Sorter

How to upload your Framework Gem to RubyGems.org

How to upload your app to Heroku

Exercise 10 - Handling Exceptions

Exercise 11 - Upload Gem and App

The course contents are subject to change.

Mentors

Satish Talim and Victor Goff III from the RubyLearning team.

Some …

rubylearning.com Read
  Source Favicon
By Tom Fakes of CRAZ8 over 1 year ago.
Email

…the request matches the ETag value it calculates from the object you pass it, sets the Response to be a Not Modified, which causes Rails to bypass rendering the view.

You can use either fresh_when or stale? , depending on how your code is structured. The Rails documentation example for using fresh_when looks like this:

1 2 3 4 def show @ article = Article .find(params[ :id ]) fresh_when( :etag => @ article , :last_modified => …

blog.craz8.com Read
  Source Favicon
By Simone Carletti of Simone Carletti's Blog almost 4 years ago.
Email

…visibility to the appropriate AJAX events. Also, on success replace the content of # response with the response data. jQuery(function($) { // create a convenient toggleLoading function var toggleLoading = function() { $("#loading").toggle() };

$("#tool-form") .bind("ajax:loading", toggleLoading) .bind("ajax:complete", toggleLoading) .bind("ajax:success", function(data, status, xhr) { $("#response").html(status); …

simonecarletti.com Read
  Source Favicon
By techarch of The "Tech. Arch." almost 4 years ago.
Email

So now let's call our provider api: @ response = @access_token.get('/api/timenow') @ info = @response.body

You should get back a json object:

Yippee!!!

Recap

So this concludes our whirlwind tour of OAuth from a provider and consumer side. I am leaving the following enhancements for you to do on your own:

provider logout

provider user registration

provider view of all registered applications for a given user

provider view of all tokens for a …

blog.monnet-usa.com Read
  Source Favicon
By Tom Fakes of CRAZ8 over 1 year ago.
Email

3. Server Creates Response from Cached Fragments and Sends It

The server code loads up enough of the data needed by the page to use to find the fragments of the page that are cached and uses those fragments to build the response rather than running all of the rendering code. Depending on how you decide where to perform caching, a lot of the pieces of the page can be shared between users, and can be cached for a very long time. The longer the fragments are cached, the lower the total cost …

blog.craz8.com Read
  Source Favicon
On paperplanes almost 2 years ago.
Email

…to be part of the regular working schedule. In this great talk on "Resilient Response in Complex Systems" , which sparked this outburst you're currently reading (thank you, John Allspaw, you're inspiring!), John talks about Game Days at Etsy.

On Game Day, some component of the production system, I repeat, production system, is intentionally caused to fail. The purpose is to get people into the habit of dealing with failure, to get them out of the comfort …

paperplanes.de Read
  Source Favicon
Email

@ response = Net::HTTP.new(url.host, url.port).start do |http| http.request(request) end @parsed_response = Nokogiri::XML(@response.body) end

Then 'I receive a HTTP 200' do @response.code.to_i.should == 200 end

Then 'I should see "$xpath" in the response XML' do |xpath| @parsed_response.xpath(xpath).should_not be_empty, "could not find #{xpath} in: #{@response.body.inspect}" end

We parse the response using Nokogiri and check the response …

robots.thoughtbot.com Read
  Source Favicon
On Tammer Saleh over 6 years ago.
Email

controller = UsersController.new @ request = ActionController::TestRequest.new @ response = ActionController::TestResponse.new @ user = User.find(:first) end

should_be_restful do |resource| resource.parent = :country resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13} resource.update.params = { :name => "sue" } end end

Should be restful is very configurable, but as the name states, …

tammersaleh.com Read
  Source Favicon
By Assaf of Labnotes 2 years ago.
Email

Looking good Vanity 1.8.0 is out : support for Rails 3.2 and many many bug fixes All thanks to @ dougcole who pulled it together.

Failsafe Etsy shares their experience with Resilient Response In Complex Systems .

Must watch Last week I shared a link to this presentation , here's the video for the brilliant The Mythical Team Month .

Brewing CoffeeScript Cookbook is full of community recipes of your favorite (or hated) JS dialect.

blog.labnotes.org Read