Class: CopyAi::RequestBuilder
- Inherits:
-
Object
- Object
- CopyAi::RequestBuilder
- Defined in:
- lib/copy_ai/request_builder.rb
Constant Summary collapse
- DEFAULT_HEADERS =
{"Content-Type" => "application/json"}.freeze
- HTTP_METHODS =
{ get: Net::HTTP::Get, post: Net::HTTP::Post }.freeze
Instance Method Summary collapse
Instance Method Details
#build(http_method:, uri:, authenticator:, body:) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/copy_ai/request_builder.rb', line 14 def build(http_method:, uri:, authenticator:, body:) raise ArgumentError, "Missing Credentials" unless authenticator request = create_request(http_method:, uri:, body:) add_headers(request:, header: authenticator.header) request end |