Class: ShopifyApiBruv::Clients::HttpRequest
- Inherits:
-
Object
- Object
- ShopifyApiBruv::Clients::HttpRequest
- Defined in:
- lib/shopify_api_bruv/clients/http_request.rb
Constant Summary collapse
- VALID_METHODS =
[ :get, :delete, :put, :post ].freeze
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(api:, method:, path:, body:, content_type:, query: nil, headers:) ⇒ HttpRequest
constructor
A new instance of HttpRequest.
Constructor Details
#initialize(api:, method:, path:, body:, content_type:, query: nil, headers:) ⇒ HttpRequest
Returns a new instance of HttpRequest.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 15 def initialize(api:, method:, path:, body:, content_type:, query: nil, headers:) @api = api @method = method @path = path @body = body.is_a?(Hash) ? body.to_json : body @content_type = content_type @query = query @headers = headers validate ShopifyApiBruv.logger( method: :info, message: "Shopify API Request (Method: #{method}):\nPath:\n#{path}\n\nBody:\n#{body}" ) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def api @api end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def body @body end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def content_type @content_type end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def path @path end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
6 7 8 |
# File 'lib/shopify_api_bruv/clients/http_request.rb', line 6 def query @query end |