Skip to content

Commit

Permalink
Adding support for API URLs not ending in ".json" via RemoteModel.ext…
Browse files Browse the repository at this point in the history
…ension
  • Loading branch information
clayallsopp committed May 9, 2012
1 parent 8d8070f commit 1868995
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ module RemoteModule
class RemoteModel
class << self
attr_accessor :root_url, :default_url_options
attr_writer :extension

def extension
@extension || (self == RemoteModel ? false : RemoteModel.extension) || ".json"
end

#################################
# URLs for the resource
Expand Down Expand Up @@ -53,7 +58,7 @@ def complete_url(fragment)
if fragment[0..3] == "http"
return fragment
end
(self.root_url || RemoteModule::RemoteModel.root_url) + fragment + ".json"
(self.root_url || RemoteModule::RemoteModel.root_url) + fragment + self.extension
end

def http_call(method, url, call_options = {}, &block)
Expand Down

0 comments on commit 1868995

Please sign in to comment.