Class: Essential::Account

Inherits:
Resource show all
Includes:
Resource::Update
Defined in:
lib/essential/account.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource::Update

#update

Methods inherited from Resource

#==, #as_json, #fetch, #init_from, #inspect, #loaded?, request, #to_json

Methods included from Resource::AttrMethods

#filter_attrs, included

Constructor Details

#initialize(sid: nil, headers: nil, attrs: nil) ⇒ Account

Returns a new instance of Account.



18
19
20
21
22
# File 'lib/essential/account.rb', line 18

def initialize(sid: nil, headers: nil, attrs: nil)
  sid ||= Essential.sid

  super(sid: sid, headers: headers, attrs: attrs)
end

Class Method Details

.retrieve(opts = {}, headers: {}) ⇒ Object



8
9
10
11
12
# File 'lib/essential/account.rb', line 8

def self.retrieve(opts={}, headers: {})
  me = self.new(headers: headers)
  me.fetch
  me
end

.urlObject



14
15
16
# File 'lib/essential/account.rb', line 14

def self.url
  "/v2/account"
end

Instance Method Details

#channelsObject



28
29
30
# File 'lib/essential/account.rb', line 28

def channels
  Essential::Resource::PaginatorProxy.new(Essential::Messaging::Channel, headers: @headers)
end

#messagesObject



40
41
42
# File 'lib/essential/account.rb', line 40

def messages
  Essential::Resource::PaginatorProxy.new(Essential::Messaging::Message, headers: @headers)
end

#subscribersObject



32
33
34
# File 'lib/essential/account.rb', line 32

def subscribers
  Essential::Resource::PaginatorProxy.new(Essential::Messaging::Subscriber, headers: @headers)
end

#transportsObject



36
37
38
# File 'lib/essential/account.rb', line 36

def transports
  Essential::Resource::PaginatorProxy.new(Essential::Messaging::Transport, headers: @headers)
end

#urlObject



24
25
26
# File 'lib/essential/account.rb', line 24

def url
  self.class.url
end