Sha256: 732fd61aeb465ffcad28a1b01dbd2b1606c29fb569ef626fbc8cd516029cbc35

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

module Twilio
  module REST
    module TaskRouter
      module Statistics
        def statistics(args={})
          path = "#{@path}/Statistics"
          response = @client.get(path, args, true)
          statistics_class.new(path, @client, response)
        end

        private

        ##
        # Gets the class for the statistics of the current class.
        # Should just be Object.const_get("#{self.class.to_s}Statistics") but
        # Ruby 1.9.3 did not agree. Can be updated if support is dropped.
        def statistics_class
          current_class = self.class.to_s.split('::').last
          statistics_class = Twilio::REST::TaskRouter.const_get(
            "#{current_class}Statistics"
          )
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twilio-ruby-4.2.0 lib/twilio-ruby/rest/task_router/statistics.rb
twilio-ruby-4.1.0 lib/twilio-ruby/rest/task_router/statistics.rb
twilio-ruby-4.0.1 lib/twilio-ruby/rest/task_router/statistics.rb
twilio-ruby-4.0.0 lib/twilio-ruby/rest/task_router/statistics.rb