Class: Telapi::Usage

Inherits:
Resource
  • Object
show all
Defined in:
lib/telapi/usage.rb

Overview

Wraps TelAPI Usage functionality

Class Method Summary collapse

Methods inherited from Resource

#attributes, #initialize

Methods included from Network

api_uri, default_options, delete, post, response_format

Constructor Details

This class inherits a constructor from Telapi::Resource

Class Method Details

.get(id) ⇒ Object

Returns a specific Telapi::Usage object given its id See www.telapi.com/docs/api/rest/accounts/view-usage/



23
24
25
26
# File 'lib/telapi/usage.rb', line 23

def get(id)
  response = Network.get(['Usages', id])
  Usage.new(response)
end

.list(optional_params = {}) ⇒ Object

Returns a resource collection containing Telapi::Usage objects See www.telapi.com/docs/api/rest/accounts/list-usages/

Optional params is a hash containing:

Day

day in the following format: DD

Month

month in the following format: MM

Year

year in the following format: YYYY

Product

integer representing a product

Page

integer greater than 0

PageSize

integer greater than 0



16
17
18
19
# File 'lib/telapi/usage.rb', line 16

def list(optional_params = {})
  response = Network.get(['Usages'], optional_params)
  ResourceCollection.new(response, 'usages', self)
end