Class: OTRS::Ticket::Type

Inherits:
OTRS
  • Object
show all
Defined in:
lib/otrs_connector/otrs/ticket/type.rb

Overview

::Ticket

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OTRS

api_url, api_url=, #attributes, #connect, connect, get_from_remote, object_preprocessor, password, password=, process_response, setup_connection_params, user, user=

Constructor Details

#initialize(attributes = {}) ⇒ Type

Returns a new instance of Type.



8
9
10
11
12
# File 'lib/otrs_connector/otrs/ticket/type.rb', line 8

def initialize(attributes = {})
  attributes.each do |name, value|
    send("#{name.to_s.underscore.to_sym}=", value)
  end
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/otrs_connector/otrs/ticket/type.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/otrs_connector/otrs/ticket/type.rb', line 3

def name
  @name
end

Class Method Details

.allObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/otrs_connector/otrs/ticket/type.rb', line 14

def self.all
  data = { 'UserID' => 1 }
  params = { :object => 'TicketObject', :method => 'TicketTypeList', :data => data }
  a = connect(params)
  a = Hash[*a]
  b = []
  a.each do |key,value|
    c = {}
    c[key] = value
    b << c
  end
  c = self.superclass::Relation.new
  b.each do |d|
    d.each do |key,value|
      tmp = {}
      tmp[:id] = key
      tmp[:name] = value
      c << new(tmp)
    end
  end
  c
end

.all_nameObject



37
38
39
40
41
42
43
# File 'lib/otrs_connector/otrs/ticket/type.rb', line 37

def self.all_name
  collection = []
  self.all.each do |s|
    collection << s.name
  end
  return collection
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/otrs_connector/otrs/ticket/type.rb', line 4

def persisted?
  false
end