Sha256: 6971bfb8a6d72160131957c89c62c011cc7050a282b4afdd977fa757892d6f08
Contents?: true
Size: 757 Bytes
Versions: 6
Compression:
Stored size: 757 Bytes
Contents
# frozen_string_literal: true module BloomRemitClient module Requests class RequestsSender include Virtus.model include ActiveModel::Validations attribute :type, String attribute :body, String attribute :headers, Hash, lazy: true, default: ->(object, attribute) { RequestsSender.default_headers } attribute :url, Requests::UrlBuilder validates :type, presence: true, inclusion: Requests::REQUEST_TYPES def self.default_headers @default_headers ||= { 'Content-Type' => Requests::CONTENT_TYPE_JSON_UTF8, 'Accept' => Requests::CONTENT_TYPE_JSON } end def call HTTParty.send(type, url.(), body: body, headers: headers) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems