Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding support for API URLs not ending in ".json" via RemoteModel.ext…

…ension
  • Loading branch information...
commit 18689958219ff6023bbf12469308c1fd976d438a 1 parent 8d8070f
@clayallsopp authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/requests.rb
View
7 lib/requests.rb
@@ -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
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.