Module: JsonApi
- Defined in:
- app/models/json_api.rb
Class Method Summary collapse
Class Method Details
.send_request(uri_string, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/models/json_api.rb', line 2 def self.send_request(uri_string, = {}) uri = URI.parse(URI.escape(uri_string)) Rails.logger.debug uri # handle Ruby 2 OpenSSL cert issue: https://gist.github.com/mislav/5026283 [:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE if Rails.env.development? || Rails.env.test? response_body = open(uri, ).read Rails.logger.info "#{uri} => #{response_body}" json = JSON.parse(response_body) json end |