Sha256: b46ac745703c907daea9d96def18a58e7b62abb005bbfca4e6fa17e7966ffe1c

Contents?: true

Size: 767 Bytes

Versions: 6

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

module RDStation
  class Emails
    include HTTParty
    include ::RDStation::RetryableRequest

    def initialize(authorization:)
      @authorization = authorization
    end

    def all(query_params={})
      retryable_request(@authorization) do |authorization|
        response = self.class.get(base_url, headers: authorization.headers, query: query_params)
        ApiResponse.build(response)
      end
    end

    def by_id(id)
      retryable_request(@authorization) do |authorization|
        response = self.class.get(base_url(id), headers: authorization.headers)
        ApiResponse.build(response)
      end
    end

    private

    def base_url(path='')
      "#{RDStation.host}/platform/emails/#{path}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 lib/rdstation/emails.rb
rdstation-ruby-client-2.8.2 lib/rdstation/emails.rb
rdstation-ruby-client-2.8.1 lib/rdstation/emails.rb
rdstation-ruby-client-2.8.0 lib/rdstation/emails.rb
rdstation-ruby-client-2.7.0 lib/rdstation/emails.rb
rdstation-ruby-client-2.6.0 lib/rdstation/emails.rb