Created
December 31, 2013 01:08
-
-
Save twerth/8190843 to your computer and use it in GitHub Desktop.
Patch for NSRails to allow for additional_query_parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NSRConfig | |
# In AppDelegate: NSRConfig.defaultConfig.additional_query_parameters = {auth_token: 'yourtoken'} | |
attr_accessor :additional_query_parameters | |
end | |
class NSRRequest | |
alias :old_http_request :HTTPRequest | |
def HTTPRequest | |
if additional_params = self.config.additional_query_parameters | |
self.queryParameters = {} unless self.queryParameters | |
self.queryParameters.merge!(additional_params) | |
end | |
old_http_request | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment