Class: Mpayer::Fetch
- Inherits:
-
Object
- Object
- Mpayer::Fetch
- Includes:
- HTTParty
- Defined in:
- lib/mpayer_ruby/fetch.rb
Class Method Summary collapse
Class Method Details
.headers ⇒ Object
11 12 13 |
# File 'lib/mpayer_ruby/fetch.rb', line 11 def headers Mpayer.configuration.header.merge!(super) end |
.load_json? ⇒ Boolean
35 36 37 38 |
# File 'lib/mpayer_ruby/fetch.rb', line 35 def load_json? # load JSON if WebMock is off while testing and only in local env with load mpayer turned on defined?(WebMock).nil? and ENV['CI_TEST'].nil? and defined?(Minitest) and ENV['LOAD_MPAYER'] == "true" end |
.save_json(response) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/mpayer_ruby/fetch.rb', line 27 def save_json(response) request_method = response.request.http_method.name.split('::').last.upcase file_path = response.request.path.to_s slash,model,*file_name = file_path.split('?')[0].split(/\/|\?/) file_location = "lib/mpayer_ruby/support/fake_mpayer/#{model}/#{request_method}_#{file_name.join('_')}.json" File.write(file_location, response.body) end |