Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision eca75f82

Von Jan Büren vor 8 Monaten hinzugefügt

  • ID eca75f821b11f1fdb3b21e43c50c3216702b79b3
  • Vorgänger 4ad6c50e
  • Nachfolger f4a87e7a

kix18: Neue Methode get_ticket

Unterschiede anzeigen:

SL/KIX18Client.pm
33 33
  return $params{article}{TicketID};
34 34
}
35 35

  
36
sub get_ticket {
37
  my ($self) = shift;
38
  die "Invalid connection state" unless $self->connector->can('GET');
39

  
40
  validate(
41
    @_, {
42
          ticket_id => 1,
43
        }
44
  );
45
  my %params = @_;
46

  
47
  my $ret = _decode_and_status_code($self->connector->GET("tickets/$params{ticket_id}"));
48

  
49
  return $ret;
50
}
51

  
36 52
sub create_ticket {
37 53
  my ($self) = shift;
38 54
  die "Invalid connection state" unless $self->connector->can('POST');
......
64 80
          Body    => 1,
65 81
          Channel     => { type => SCALAR, default => 'note'                      },
66 82
          Charset     => { type => SCALAR, default => 'utf-8'                     },
67
          MimeType    => { type => SCALAR, default => 'text/plain',               },
68
          ContentType => { type => SCALAR, default => 'text/plain; charset=utf-8' },
83
          MimeType    => { type => SCALAR, default => 'text/html',               },
84
          ContentType => { type => SCALAR, default => 'text/html; charset=utf-8' },
69 85

  
70 86
          TicketID => { callbacks => {
71 87
                         'is an integer' => sub {
......
82 98
  # therefore the defaults need to be defined again:
83 99
  $params{Channel}     //= 'note';
84 100
  $params{Charset}     //= 'utf-8';
85
  $params{MimeType}    //= 'text/plain';
86
  $params{ContentType} //= 'text/plain; charset=utf-8';
101
  $params{MimeType}    //= 'text/html';
102
  $params{ContentType} //= 'text/html; charset=utf-8';
87 103

  
88 104
  my %a_params = ();
89 105
  foreach (keys %params) {
......
137 153
  my ($ret) = @_;
138 154

  
139 155
  die t8("Unsuccessful HTTP return code: #1 Details: #2", $ret->responseCode(), $ret->responseContent())
140
    unless $ret->responseCode() == 201;
156
    unless $ret->responseCode() == 201 || $ret->responseCode() == 200;
141 157

  
142 158
  try {
143 159
   return decode_json($ret->responseContent());
......
185 201

  
186 202
=over 4
187 203

  
204
=item C<get_ticket $ticket_id>
205

  
206
Gets the specific ticket with $ticket_id and returns all standard ticket data
207
as a nested hash structure.
208

  
188 209
=item C<create_ticket $Title>
189 210

  
190 211
Creates a Ticket with the named param Title. Returns the ID of the created Ticket.

Auch abrufbar als: Unified diff