21 May 2012

The Ruby Reflector

 
Star Following

  Source Favicon
By Casper Fabricius of casperfabricius.com 8 months ago.
Email

The talk is titled " Dogfood your API" and is about the Podio API and how our entire web application is based on the API, never making a single direct database call. The API is written in Python and the web app in Ruby in Rails, so we will be able to touch upon both languages and frameworks in our talk.

I'll be presenting with Christian Holm, the lead developer of Podio and main developer of the API. He will explain the evolvement of the API and some …

casperfabricius.com Read
  Source Favicon
By Patrick Reagan, Development Director of Viget Extend : The Development Lab 8 months ago.
Email

You'll notice the API change that I mentioned earlier -- my Credential resource now has a collection of errors due to how ActiveModel validations work. While this is a departure from the original example, I think that this is a subtle improvement that makes the API more user-friendly during debugging.

Conclusion

When solving a particular problem in an OO language, it often makes sense to take a step back and think about the conceptual entities involved and how they collaborate …

viget.com Read
  Source Favicon
By paul of Pogodan Blog 8 months ago.
Email

…files to set per-application environment variables for configuration (e.g. DB URIs, API keys, etc.) on our dev machines. rbenv by contrast works through "shims" which are used only when you run a shim'ed ruby command

Luckily rbenv is (quickly being) built to be easily extended through hooks and plugins. Here all we need is a simple hook. Hooks are added per-command in rbenv, and in this case we want to hook into the 'exec' command, so we can export variables before …

pogodan.com Read
  Source Favicon
By David of David Chelimsky 8 months ago.
Email

APIs which are invoked by the code being specified . In this case, we're stubbing an API ( as_json ) that is invoked by the Rails framework, not the code being specified. If the Rails framework ever changes how it renders json, this example would continue to pass, but it would be a false positive.

One possible remedy

Here's how I'd approach this outside-in (based on my own flow, design preferences, and target outcomes. YMMV.)

Start with a request spec:

require …

blog.davidchelimsky.net Read
  Source Favicon
By Gregory Brown of Practicing Ruby 8 months ago.
Email

…parameters hash into a more local setting. With a little creativity, it's relatively easy to make the API look a little nicer by letting Mailer#deliver create the message object for you. mailer.deliver do |message| message.to = "gregory.t.brown@gmail.com" message.from = "fake@fake.com" message.subject = "You have won a lifetime supply of..." message.body = "Dear Sir, I am pleazed to inform..." end

This sort of API is fairly …

blog.rubybestpractices.com Read
  Source Favicon
By Eric Hodel of RubyCorner 8 months ago.
Email

Net:: HTTP supports persistent connections with some API methods but does not handle reconnection gracefully. net-http-persistent supports reconnection and retry according to RFC 2616.

Changes:

2.0 / 2011-08-26

Incompatibility

Net:: HTTP::Persistent#verify_mode now defaults to OpenSSL:: SSL:: VERIFY PEER. This may cause HTTPS request failures if your default certificate store lacks the correct certificates.

1.9 / 2011-08-26

Minor Enhancement

Added Net:: HTTP…

rubycorner.com Read
  Source Favicon
By Eric Wong of Practicing Ruby 8 months ago.
Email

…not recommended and will result in errors or exceptions.

If you need more detailed descriptions, check `ri' or other Ruby doc for Ruby methods. For C library functions and system calls, your Unix-like OS should provide manpages and you can search online, too. I have no intention of regurgitating API documentation.

License: GPLv3 (or later, at the discretion of Eric Wong)

blog.rubybestpractices.com Read
  Source Favicon
By Jason Seifer of The Ruby Show 8 months ago.
Email
  Source Favicon
By Michael Blake of Running With Rails 8 months ago.
Email

…into your views and gives you directives you can use to fill in your data. It makes for the kind of API that I cringe at. You use directives and the whole view ends up wrapped in a script tag that I can't help but dislike.

So what did I want to do instead? What would make templating, a heavy and complex task, more beautiful. HTML tags I decided. HTML tags for all. data-src, data-val, data-href, data-click, data-class, data-id. Templating to override, append, and generally drive …

runningwithrails.com Read
  Source Favicon
By ben of BenCurtis.com 8 months ago.
Email

Earlier this week I released version 1.0 of the Faker gem . It's been about 4 years since the initial release of the gem, and the API has been fairly stable for the last couple of years, so I figured it was a good time to make the jump to 1.0. :)

This release finishes the conversion to I18n. Just about everything is in the locale files now, including the ability to define custom formats for everything -- company names, street addresses, etc. And, with the magic of method_missing, …

bencurtis.com Read