Module: WolfCore::HttpDataSource
- Defined in:
- lib/wolf_core/infrastructure/http_data_source.rb
Class Method Summary collapse
- .http_get(url:, headers: {}, query: nil) ⇒ Object
- .http_post(url:, headers: {}, query: nil, body: nil) ⇒ Object
Class Method Details
.http_get(url:, headers: {}, query: nil) ⇒ Object
5 6 7 |
# File 'lib/wolf_core/infrastructure/http_data_source.rb', line 5 def http_get(url:, headers: {}, query: nil) HTTParty.get(url, headers: headers, query: query) end |
.http_post(url:, headers: {}, query: nil, body: nil) ⇒ Object
9 10 11 12 13 |
# File 'lib/wolf_core/infrastructure/http_data_source.rb', line 9 def http_post(url:, headers: {}, query: nil, body: nil) headers['Content-Type'] ||= 'application/json' body = body&.to_json if headers['Content-Type'] == 'application/json' HTTParty.post(url, headers: headers, query: query, body: body) end |