Class: Fal::Request
- Inherits:
-
Object
- Object
- Fal::Request
- Defined in:
- lib/fal/request.rb
Overview
Builds HTTP request components (headers, body).
Constant Summary collapse
- CONTENT_TYPE =
"application/json"- USER_AGENT =
"fal-ruby/#{VERSION}"
Instance Method Summary collapse
- #body(input) ⇒ Object
- #headers ⇒ Object
-
#initialize(config:) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(config:) ⇒ Request
11 12 13 |
# File 'lib/fal/request.rb', line 11 def initialize(config:) @config = config end |
Instance Method Details
#body(input) ⇒ Object
23 24 25 |
# File 'lib/fal/request.rb', line 23 def body(input) JSON.generate(input) end |
#headers ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/fal/request.rb', line 15 def headers { "Authorization" => "Key #{@config.api_key}", "Content-Type" => CONTENT_TYPE, "User-Agent" => USER_AGENT } end |