Sha256: 02caa3d03b0500d887b3683b342128a240d3010936f77bceb1e9b2925378e9c0

Contents?: true

Size: 1.14 KB

Versions: 10

Compression:

Stored size: 1.14 KB

Contents

module CreateSend
  module Transactional
    class Timeline < CreateSend
      attr_reader :client_id

      def initialize(auth, client_id = nil)
        @auth      = auth
        @client_id = client_id
        super
      end

      def messages(options = {})
        options = add_client_id(options)
        response = get "/transactional/messages", { :query => options }
        response.map{|item| Hashie::Mash.new(item)}
      end

      def statistics(options = {})
        options = add_client_id(options)
        response = get "/transactional/statistics", { :query => options }
        Hashie::Mash.new(response)
      end

      def details(message_id, options = {})
        options = add_client_id(options)
        response = get "/transactional/messages/#{message_id}", { :query => options }
        Hashie::Mash.new(response)
      end

      def resend(message_id)
        response = post "/transactional/messages/#{message_id}/resend"
        response.map{|item| Hashie::Mash.new(item)}
      end

      private

      def add_client_id(options)
        options['clientID'] = @client_id if @client_id
        options
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
createsend-6.1.1 lib/createsend/transactional_timeline.rb
createsend-sendowlfork-6.1.0.pre.hashie5 lib/createsend/transactional_timeline.rb
createsend-6.1.0 lib/createsend/transactional_timeline.rb
createsend-6.0.0 lib/createsend/transactional_timeline.rb
createsend-5.1.1 lib/createsend/transactional_timeline.rb
createsend-5.1.0 lib/createsend/transactional_timeline.rb
createsend-5.0.0 lib/createsend/transactional_timeline.rb
createsend-4.1.2 lib/createsend/transactional_timeline.rb
createsend-4.1.1 lib/createsend/transactional_timeline.rb
createsend-4.1.0 lib/createsend/transactional_timeline.rb