Class: DataSift::Account

Inherits:
ApiResource show all
Defined in:
lib/account.rb

Overview

Class for accessing DataSift’s Account API

Constant Summary

Constants inherited from ApiResource

DataSift::ApiResource::TLSv1, DataSift::ApiResource::TLSv1_2

Constants included from DataSift

APPLICATION_JSON, DELETE, DETECT_DEAD_SOCKETS, GET, HEAD, IS_WINDOWS, KNOWN_SOCKETS, SOCKET_DETECTOR_TIMEOUT, VERSION, X_ANALYSIS_TASKS_QUEUED, X_ANALYSIS_TASKS_QUEUE_LIMIT, X_INSIGHT_TASKS_QUEUED, X_INSIGHT_TASKS_QUEUE_LIMIT, X_RATELIMIT_COST, X_RATELIMIT_LIMIT, X_RATELIMIT_REMAINING, X_TASKS_QUEUED, X_TASKS_QUEUE_LIMIT

Instance Method Summary collapse

Methods inherited from ApiResource

#initialize, #requires

Methods included from DataSift

#build_path, request

Constructor Details

This class inherits a constructor from DataSift::ApiResource

Instance Method Details

#usage(start_time, end_time, period = '') ⇒ Object

Check your account usage for a given period and timeframe

Parameters:

  • period (String) (defaults to: '')

    (Optional) Period is one of either hourly, daily or monthly

  • start_time (Integer)

    (Optional) Unix timestamp of the start of the period you are querying

  • end_time (Integer)

    (Optional) Unix timestamp of the end of the period you are querying

Returns:

  • (Object)

    API reponse object



13
14
15
16
17
18
# File 'lib/account.rb', line 13

def usage(start_time, end_time, period = '')
  params = { start: start_time, end: end_time }
  params.merge!(period: period) unless period.empty?

  DataSift.request(:GET, 'account/usage', @config, params)
end