Permalink
Browse files

Add support for YAML response format

  • Loading branch information...
1 parent a1a4f6f commit cb7812ee458c4936caa62302558039ffee810804 @sferik sferik committed Jul 2, 2011
Showing with 203 additions and 184 deletions.
  1. +1 −1 lib/gems/client.rb
  2. +2 −0 lib/gems/connection.rb
  3. +1 −1 lib/gems/request.rb
  4. +2 −0 spec/fixtures/owners.yaml
  5. +197 −182 spec/gems/client_spec.rb
View
@@ -105,7 +105,7 @@ def gems
# @example
# Gems.owners('gemcutter')
def owners(gem_name)
- get("/api/v1/gems/#{gem_name}/owners", {}, :json)
+ get("/api/v1/gems/#{gem_name}/owners")
end
# Add an owner to a RubyGem you own, giving that user permission to manage it
@@ -23,6 +23,8 @@ def connection(format=format)
connection.use Faraday::Response::ParseMarshal
when 'xml'
connection.use Faraday::Response::ParseXml
+ when 'yaml'
+ connection.use Faraday::Response::ParseYaml
end
connection.use Faraday::Response::RaiseError
connection.adapter Faraday.default_adapter
View
@@ -29,7 +29,7 @@ def request(method, path, options, format)
def formatted_path(path, format)
case format.to_s.downcase
- when 'json', 'xml'
+ when 'json', 'xml', 'yaml'
[path, format].compact.join('.')
when 'marshal', 'raw'
path
@@ -0,0 +1,2 @@
+---
+- email: sferik@gmail.com
Oops, something went wrong. Retry.

0 comments on commit cb7812e

Please sign in to comment.