Class: Zanox::ProgramApplication

Inherits:
Item
  • Object
show all
Defined in:
lib/zanox/resources/program_application.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hashable

#to_hash

Constructor Details

#initialize(data) ⇒ ProgramApplication

  • pid (Integer) ProgramApplication ID

  • program (Hash) Infos about the program (activation status, id and name)

  • adspace (Hash) Infos about the adspace (id and name)

  • status (String) The status of the program (open, confirmed, rejected, deferred, waiting, blocked, terminated, canceled, called, declined, deleted)

  • allow_tpv (Boolean)



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/zanox/resources/program_application.rb', line 36

def initialize(data)
  @pid     = data['@id'].to_i
  @program = {
    active: data['program']['@active'] == 'true',
    id:     data['program']['@id'].to_i,
    name:   data['program']['$']
  }
  @adspace  = {
    id:     data['adspace']['@id'],
    name:   data['adspace']['$']
  }
  @status    = data['status']
  @allow_tpv = data['allowTpv']
end

Instance Attribute Details

#adspaceObject (readonly)

Returns the value of attribute adspace.



27
28
29
# File 'lib/zanox/resources/program_application.rb', line 27

def adspace
  @adspace
end

#allow_tpvObject (readonly)

Returns the value of attribute allow_tpv.



27
28
29
# File 'lib/zanox/resources/program_application.rb', line 27

def allow_tpv
  @allow_tpv
end

#pidObject (readonly)

Returns the value of attribute pid.



27
28
29
# File 'lib/zanox/resources/program_application.rb', line 27

def pid
  @pid
end

#programObject (readonly)

Returns the value of attribute program.



27
28
29
# File 'lib/zanox/resources/program_application.rb', line 27

def program
  @program
end

#statusObject (readonly)

Returns the value of attribute status.



27
28
29
# File 'lib/zanox/resources/program_application.rb', line 27

def status
  @status
end

Class Method Details

.find(args = {}) ⇒ Object



52
53
54
55
# File 'lib/zanox/resources/program_application.rb', line 52

def find(args = {})
  response = API.request(:programapplications, args)
  response.program_application_items.map { |program_application| new(program_application) }
end