Exemplo n.º 1
0
 /**
  * @depends testConfiglessConstructor
  */
 public function testConstructor()
 {
     $connection = new Connection('https://*****:*****@test.freshdesk.com');
     $contact = new Contact($connection);
     $sectionGetters = $this->configlessProvider();
     $sectionGetters = array_pop($sectionGetters);
     foreach ($sectionGetters as $section) {
         $section = Rest::GetSection($section);
         if ($section instanceof Contact) {
             $this->assertEquals($contact, $section);
         }
         $configs = $this->getConnection($section, $contact);
         $this->assertEquals($configs['expected'], $configs['instance']);
         $this->assertEquals($configs['instance']->getBaseUrl(), $connection->getBaseUrl());
         $this->assertEquals($configs['expected']->getBaseUrl(), $connection->getBaseUrl());
         $this->assertEquals($configs['expected']->getDomain(), $connection->getDomain());
         $this->assertEquals($configs['instance']->getDomain(), $connection->getDomain());
         $this->assertEquals($configs['instance']->getScheme(), $connection->getScheme());
         $this->assertEquals($configs['expected']->getScheme(), $connection->getScheme());
         $this->assertEquals($configs['instance']->getUserName(), $connection->getUserName());
         $this->assertEquals($configs['expected']->getUserName(), $connection->getUserName());
         $this->assertEquals($configs['expected']->getPassword(), $connection->getPassword());
         $this->assertEquals($configs['instance']->getPassword(), $connection->getPassword());
     }
 }
Exemplo n.º 2
0
  </head>
  <body bgcolor="F8F7ED">
    <?php 
include 'http://rit.edu/framework/v0/rit-identitybar.html';
?>
    <div class="container">
      <div class="row">
        <div class="col-md-6 col-md-offset-3" style="background-color: rgb(243,110,33);color: white;margin-top: 50pt;">
          <h1>Current Open Tickets</h1>
          <?php 
require 'vendor/autoload.php';
include 'config.php';
use Freshdesk\Config\Connection, Freshdesk\Rest, Freshdesk\Ticket, Freshdesk\Model\Contact, Freshdesk\Model\Ticket as TicketM, Freshdesk\Tool\ModelGenerator;
$url = 'https://' . $KEY . ':X@chester.freshdesk.com';
$conf = new Connection($url);
$fd = new Rest($conf);
$tckts = $fd->getAllTickets(0, 'new_and_my_open');
echo '<table class="table table-striped table-bordered" style="background-color: #FFFFFF">';
echo '<tr>';
echo '<th> Requester </th>';
echo '<th> Problem </th>';
echo '</tr>';
foreach ($tckts as &$tckt) {
    $requester = $tckt->requester_name;
    $desc = $tckt->description;
    $title = $tckt->subject;
    echo '<tr>';
    echo '<td>' . $requester . '</td>';
    echo '<td>' . $title . '</td>';
    echo '</tr>';
}
Exemplo n.º 3
0
$tickets = $t->getGroupedTickets('*****@*****.**', false);
//choose a ticket
$model = new TicketM(array('display_id' => 12345));
$t = new Ticket($conf);
//get all data associated with this id
$model = $t->getFullTicket($model);
//close a ticket
$ticket = $t->updateTicket($model->setStatus(4));
//fire up the generator
$gen = new ModelGenerator($conf);
//generate class, extending from the TicketM class
//will create properties, setters and getters for all
//properties not present in base class
echo $gen->generateTicketClass($model, 'YourTicket', '/home/user/abs/path/to/YourTicket.php');
//basic/general rest calls
$fd = new Rest($conf);
//get ticket, this call will be removed from Rest class & moved to Ticket class
$json = $fd->getSingleTicket(1701);
print_r($json);
//for ticket-calls:
$t = new Ticket($conf);
//create new ticket
$model = new TicketM(array('description' => 'Ignore this ticket, it is a test', 'subject' => 'API-test', 'email' => '*****@*****.**'));
//create new ticket, basic example
$t->createNewTicket($model);
//Assign a ticket to an agent/responder:
$responderId = 123456;
$t->assignTicket($model, $responderId);
//delete a ticket:
$t->deleteTicket($model);
//pass true as second argument to force a reload of the ticket