Class: OfficeBoy::Request
- Inherits:
-
Object
- Object
- OfficeBoy::Request
- Defined in:
- lib/office_boy/request.rb
Class Method Summary collapse
Class Method Details
.call(method_name:, path:, payload: '') ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/office_boy/request.rb', line 3 def self.call(method_name:, path:, payload: '') raise Errors::NotDefiniedApiKey unless OfficeBoy.configuration.sendgrid_api_key RestClient::Request.execute( method: method_name, url: "https://api.sendgrid.com/v3/#{path}", payload: JSON.generate(payload), headers: { 'Authorization' => "Bearer #{OfficeBoy.configuration.sendgrid_api_key}", 'Content-Type' => 'application/json' } ) end |