Commits on May 18, 2012
Commits on May 17, 2012
Commits on May 9, 2012
`Singly::Client#profiles` returns profile data for the user associated with an `access_token`, or else raises an exception when no token is present. Fake API responses will be available in `spec/fixtures/*api_path/:response_code.json`, where `api_path` parallels the path on the server. This should leave a straightforward way to record responses in the future (you can pipe them straight from curl whenever they need creating/updating). Delegating everything to `StubApi` also leaves an easy way to shut off stubbing in the future to test against the real API, though the specs would need to test the format of things rather than specific data, and we'd need a real `access_token`.
If the request is successful, its body will be parsed as JSON and returned. Otherwise, a `Net::HTTPError` is raised containing the error text and `Net::HTTPResponse` object. `WebMock` is used to specify responses. For sake of simple implementation and consistent tests, it's used in the request generator tests as well, returning a simple JSON object to check. All real web requests are disabled by `WebMock.disable_net_connect!`, which lets us verify the proper URL is generated, as well as prevents hits to any real server. The URL stubs are repetetive, but nice and explicit.
Commits on May 8, 2012