Sha256: ad74203f4503c422bc864051f23aebfda2e0f8fea941495f708cc85ee366214a

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

module RDStation
  class Analytics
    include HTTParty
    include ::RDStation::RetryableRequest

    def initialize(authorization:)
      @authorization = authorization
    end

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

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

    private

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 lib/rdstation/analytics.rb
rdstation-ruby-client-2.8.2 lib/rdstation/analytics.rb
rdstation-ruby-client-2.8.1 lib/rdstation/analytics.rb
rdstation-ruby-client-2.8.0 lib/rdstation/analytics.rb