예제 #1
0
 public function buscarFrete($data, $returnType = self::RETURN_ARRAY)
 {
     $response = $this->request($data);
     $fetcher = new ParserContent($response);
     if ($error = $fetcher->checkError()) {
         return json_encode(['erro' => 1]);
     }
     $items = $fetcher->getParsedContent();
     $parser = new ResponseBuilder($items);
     $response = $parser->parse();
     switch ($returnType) {
         case self::RETURN_ARRAY:
             return $response;
             break;
         case self::RETURN_JSON:
             return json_encode($response, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
             break;
     }
 }
예제 #2
0
 public function postAnalyzer()
 {
     // return "wtf";
     $payload = Input::get('query', 'default');
     if ($payload == 'default') {
         return Response::make('you need to give an input', 405);
     }
     // $payload = json_encode(json_decode('{
     //               "keyword": "guns",
     //               "posts": [
     //                 {
     //                   "id": 1,
     //                   "text": "Guns are awesome!",
     //                   "tags": [
     //                     "twitter"
     //                   ]
     //                 },
     //                 {
     //                   "id": 2,
     //                   "text": "Guns don\'t kill people. People do.",
     //                   "tags": [
     //                     "twitter",
     //                     "friends",
     //                     "Iasi"
     //                   ]
     //                 },
     //                 {
     //                   "id": 3,
     //                   "text": "I don\'t own guns.",
     //                   "source": "facebook",
     //                   "tags": [
     //                     "facebook",
     //                     "friends"
     //                   ]
     //                 }
     //               ],
     //               "tools": [
     //                 "all"
     //               ]
     //             }'));
     // dd($payload);
     $response = ResponseBuilder::getAnalyzedResponse($payload);
     return Response::json($response);
 }
예제 #3
0
파일: bot.php 프로젝트: 22sk/telegram-bot
 public function __construct($results, $req, $add = null)
 {
     parent::__construct($results, $req, $add);
     $this->to(self::TO_SENDER);
 }
예제 #4
0
 /**
  * @param int $status
  *
  * @return \Mcustiel\Phiremock\Client\Utils\ResponseBuilder
  */
 public static function withStatusCode($status)
 {
     return ResponseBuilder::create($status);
 }