Class: CTM::Source

Inherits:
Base
  • Object
show all
Defined in:
lib/ctm/source.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#token

Instance Method Summary collapse

Methods inherited from Base

create, #release!

Constructor Details

#initialize(data, token = nil) ⇒ Source

Returns a new instance of Source.



6
7
8
9
10
11
12
13
14
15
# File 'lib/ctm/source.rb', line 6

def initialize(data, token=nil)
  super(data, token)
  @id            = data['id']
  @account_id    = data['account_id']
  @name          = data['name']
  @referring_url = data['referring_url']
  @landing_url   = data['landing_url']
  @position      = data['position']
  @online        = data['online']
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



3
4
5
# File 'lib/ctm/source.rb', line 3

def 
  @account_id
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ctm/source.rb', line 3

def id
  @id
end

#landing_urlObject

Returns the value of attribute landing_url.



4
5
6
# File 'lib/ctm/source.rb', line 4

def landing_url
  @landing_url
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/ctm/source.rb', line 4

def name
  @name
end

#onlineObject

Returns the value of attribute online.



4
5
6
# File 'lib/ctm/source.rb', line 4

def online
  @online
end

#positionObject

Returns the value of attribute position.



4
5
6
# File 'lib/ctm/source.rb', line 4

def position
  @position
end

#referring_urlObject

Returns the value of attribute referring_url.



4
5
6
# File 'lib/ctm/source.rb', line 4

def referring_url
  @referring_url
end

Instance Method Details

#numbers(options = {}) ⇒ Object



28
29
30
# File 'lib/ctm/source.rb', line 28

def numbers(options={})
  CTM::NumberList.new(options.merge(:account_id => @account_id, :source_id => @id), @token)
end

#saveObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/ctm/source.rb', line 17

def save
  options = {
    :name => @name,
    :position => @position,
    :online => @online,
    :referring_url => @referring_url,
    :landing_url => @landing_url
  }
  super(options)
end