File: request.rb

package info (click to toggle)
ruby-aws-sigv4 1.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 128 kB
  • sloc: ruby: 598; makefile: 4
file content (65 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# frozen_string_literal: true

require 'uri'

module Aws
  module Sigv4
    class Request

      # @option options [required, String] :http_method
      # @option options [required, HTTP::URI, HTTPS::URI, String] :endpoint
      # @option options [Hash<String,String>] :headers ({})
      # @option options [String, IO] :body ('')
      def initialize(options = {})
        @http_method = nil
        @endpoint = nil
        @headers = {}
        @body = ''
        options.each_pair do |attr_name, attr_value|
          send("#{attr_name}=", attr_value)
        end
      end

      # @param [String] http_method One of 'GET', 'PUT', 'POST', 'DELETE', 'HEAD', or 'PATCH'
      def http_method=(http_method)
        @http_method = http_method
      end

      # @return [String] One of 'GET', 'PUT', 'POST', 'DELETE', 'HEAD', or 'PATCH'
      def http_method
        @http_method
      end

      # @param [String, HTTP::URI, HTTPS::URI] endpoint
      def endpoint=(endpoint)
        @endpoint = URI.parse(endpoint.to_s)
      end

      # @return [HTTP::URI, HTTPS::URI]
      def endpoint
        @endpoint
      end

      # @param [Hash] headers
      def headers=(headers)
        @headers = headers
      end

      # @return [Hash<String,String>]
      def headers
        @headers
      end

      # @param [String, IO] body
      def body=(body)
        @body = body
      end

      # @return [String, IO]
      def body
        @body
      end

    end
  end
end