{"action":"created","comment":{"url":"https://api.github.com/repos/idevelopment/serviceforce/pulls/comments/74691147","id":74691147,"diff_hunk":"@@ -0,0 +1,147 @@\n+<?php\n+\n+namespace App\\Console\\Commands;\n+\n+use Illuminate\\Console\\Command;\n+\n+use GuzzleHttp\\Client;\n+use Psr\\Http\\Message\\ResponseInterface;\n+use GuzzleHttp\\Exception\\RequestException;\n+\n+use App\\BaseServers;\n+use App\\NetworkInformation;\n+use App\\Server;\n+use App\\serverHostingPack;\n+use App\\ServerLocation;\n+use App\\Sla;\n+\n+use App\\PayAsYouGo as PSG;\n+use App\\Customers;\n+use App\\User;\n+use Mail;\n+\n+class PayAsYouGoData extends Command\n+{\n+    /**\n+     * The name and signature of the console command.\n+     *\n+     * @var string\n+     */\n+    protected $signature = 'configure:psyg';\n+\n+    /**\n+     * The console command description.\n+     *\n+     * @var string\n+     */\n+    protected $description = 'Command description';\n+\n+    /**\n+     * Create a new command instance.\n+     *\n+     * @return void\n+     */\n+    public function __construct()\n+    {\n+        parent::__construct();\n+    }\n+\n+    /**\n+     * Execute the console command.\n+     *\n+     * @return mixed\n+     */\n+    public function handle()\n+    {\n+\n+\n+      // Get all servers that need to execute provisioning\n+            $PayAsYouGo = PYSG::where('status', 'completed')\n+                     ->orderBy('id', 'asc')\n+                     ->get();\n+\n+             foreach($PayAsYouGo as $PayAsYouGoItem){\n+\n+            $bareMetalId = $PayAsYouGoItem->bareMetalId;\n+\n+      // GET the data from the api.\n+      $modelResource = \"/bareMetals/$bareMetalId\";\n+      $apiKey   = config('ServiceForge.leaseweb.apikey');\n+      $apiUrl   = env('LEASEWEB_URL');\n+\n+      // start the inserts.\n+          $exist = BaseServers::where('bareMetalId','=', $PayAsYouGoItem['bareMetalId'])->count();\n+          if ($exist === 0) {\n+            $ch = curl_init();\n+            curl_setopt($ch, CURLOPT_URL, $apiUrl . $modelResource);\n+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n+            curl_setopt($ch, CURLOPT_HTTPHEADER, array(\"X-Lsw-Auth: $apiKey\"));\n+\n+            $output = curl_exec($ch);\n+            $json = json_decode($output, true);\n+\n+            print_r($json);\n+\n+              // network details.\n+              $network = new NetworkInformation;\n+              $network->dataPack = $json['bareMetal']['network']['dataPack'];\n+              $network->ipsAssigned = $json['bareMetal']['network']['ipsAssigned'];\n+              $network->ipsFreeOfCharge = '1';\n+              $network->save();\n+\n+              // Location details.\n+              $location          = new ServerLocation;\n+              $location->Cabinet = $json['bareMetal']['location']['cabinet'];\n+              $location->Site    = $json['bareMetal']['location']['site'];\n+              $location->save();\n+\n+              // server details\n+              $server                 = new Server;\n+              $server->hardDisks      = $json['bareMetal']['server']['hardDisks'];\n+              $server->hardwareRaid   = $json['bareMetal']['server']['hardwareRaid'];\n+              $server->kvm            = $json['bareMetal']['server']['kvm'];\n+              $server->numberOfCores  = $json['bareMetal']['server']['numberOfCores'];\n+              $server->numberOfCpus   = $json['bareMetal']['server']['numberOfCpus'];\n+              $server->processorSpeed = $json['bareMetal']['server']['processorSpeed'];\n+              $server->processorType  = $json['bareMetal']['server']['processorType'];\n+              $server->ram            = $json['bareMetal']['server']['ram'];\n+              $server->serverType     = $json['bareMetal']['server']['serverType'];\n+              $server->save();\n+\n+              // server hosting pack details.\n+              $hostingPack               = new serverHostingPack;\n+              $hostingPack->bareMetalId  = $json['bareMetal']['serverHostingPack']['bareMetalId'];\n+              $hostingPack->contractTerm = $json['bareMetal']['serverHostingPack']['contractTerm'];\n+              $hostingPack->serverName   = $json['bareMetal']['serverHostingPack']['serverName'];\n+              $hostingPack->serverType   = $json['bareMetal']['serverHostingPack']['serverType'];\n+              $hostingPack->startDate    = $json['bareMetal']['serverHostingPack']['startDate'];\n+              $hostingPack->save();\n+\n+              // sla details.\n+              $sla = new Sla;\n+              $sla->slaName = $json['bareMetal']['serviceLevelAgreement']['sla'];\n+              $sla->save();\n+\n+              // Base server details.\n+              $baseServer              = new BaseServers;","path":"app/Console/Commands/PayAsYouGoData.php","position":126,"original_position":126,"commit_id":"f04fbd7d5b90f07e12c8658f6344f175632f0282","original_commit_id":"f04fbd7d5b90f07e12c8658f6344f175632f0282","user":{"login":"Nitpick-CI","id":12626182,"avatar_url":"https://avatars.githubusercontent.com/u/12626182?v=3","gravatar_id":"","url":"https://api.github.com/users/Nitpick-CI","html_url":"https://github.com/Nitpick-CI","followers_url":"https://api.github.com/users/Nitpick-CI/followers","following_url":"https://api.github.com/users/Nitpick-CI/following{/other_user}","gists_url":"https://api.github.com/users/Nitpick-CI/gists{/gist_id}","starred_url":"https://api.github.com/users/Nitpick-CI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nitpick-CI/subscriptions","organizations_url":"https://api.github.com/users/Nitpick-CI/orgs","repos_url":"https://api.github.com/users/Nitpick-CI/repos","events_url":"https://api.github.com/users/Nitpick-CI/events{/privacy}","received_events_url":"https://api.github.com/users/Nitpick-CI/received_events","type":"User","site_admin":false},"body":"Line indented incorrectly; expected at least 16 spaces, found 14","created_at":"2016-08-13T19:31:11Z","updated_at":"2016-08-13T19:31:11Z","html_url":"https://github.com/idevelopment/serviceforce/pull/68#discussion_r74691147","pull_request_url":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/idevelopment/serviceforce/pulls/comments/74691147"},"html":{"href":"https://github.com/idevelopment/serviceforce/pull/68#discussion_r74691147"},"pull_request":{"href":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68","id":81219893,"html_url":"https://github.com/idevelopment/serviceforce/pull/68","diff_url":"https://github.com/idevelopment/serviceforce/pull/68.diff","patch_url":"https://github.com/idevelopment/serviceforce/pull/68.patch","issue_url":"https://api.github.com/repos/idevelopment/serviceforce/issues/68","number":68,"state":"open","locked":false,"title":"Disable register routes","user":{"login":"Tjoosten","id":5157609,"avatar_url":"https://avatars.githubusercontent.com/u/5157609?v=3","gravatar_id":"","url":"https://api.github.com/users/Tjoosten","html_url":"https://github.com/Tjoosten","followers_url":"https://api.github.com/users/Tjoosten/followers","following_url":"https://api.github.com/users/Tjoosten/following{/other_user}","gists_url":"https://api.github.com/users/Tjoosten/gists{/gist_id}","starred_url":"https://api.github.com/users/Tjoosten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tjoosten/subscriptions","organizations_url":"https://api.github.com/users/Tjoosten/orgs","repos_url":"https://api.github.com/users/Tjoosten/repos","events_url":"https://api.github.com/users/Tjoosten/events{/privacy}","received_events_url":"https://api.github.com/users/Tjoosten/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-13T16:32:37Z","updated_at":"2016-08-13T19:31:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e76a416dc8ffbf6adae80abbae49c864c2f3fa8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68/commits","review_comments_url":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68/comments","review_comment_url":"https://api.github.com/repos/idevelopment/serviceforce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/idevelopment/serviceforce/issues/68/comments","statuses_url":"https://api.github.com/repos/idevelopment/serviceforce/statuses/f04fbd7d5b90f07e12c8658f6344f175632f0282","head":{"label":"idevelopment:development","ref":"development","sha":"f04fbd7d5b90f07e12c8658f6344f175632f0282","user":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"repo":{"id":59806177,"name":"serviceforce","full_name":"idevelopment/serviceforce","owner":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/idevelopment/serviceforce","description":"","fork":false,"url":"https://api.github.com/repos/idevelopment/serviceforce","forks_url":"https://api.github.com/repos/idevelopment/serviceforce/forks","keys_url":"https://api.github.com/repos/idevelopment/serviceforce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idevelopment/serviceforce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idevelopment/serviceforce/teams","hooks_url":"https://api.github.com/repos/idevelopment/serviceforce/hooks","issue_events_url":"https://api.github.com/repos/idevelopment/serviceforce/issues/events{/number}","events_url":"https://api.github.com/repos/idevelopment/serviceforce/events","assignees_url":"https://api.github.com/repos/idevelopment/serviceforce/assignees{/user}","branches_url":"https://api.github.com/repos/idevelopment/serviceforce/branches{/branch}","tags_url":"https://api.github.com/repos/idevelopment/serviceforce/tags","blobs_url":"https://api.github.com/repos/idevelopment/serviceforce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idevelopment/serviceforce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idevelopment/serviceforce/git/refs{/sha}","trees_url":"https://api.github.com/repos/idevelopment/serviceforce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idevelopment/serviceforce/statuses/{sha}","languages_url":"https://api.github.com/repos/idevelopment/serviceforce/languages","stargazers_url":"https://api.github.com/repos/idevelopment/serviceforce/stargazers","contributors_url":"https://api.github.com/repos/idevelopment/serviceforce/contributors","subscribers_url":"https://api.github.com/repos/idevelopment/serviceforce/subscribers","subscription_url":"https://api.github.com/repos/idevelopment/serviceforce/subscription","commits_url":"https://api.github.com/repos/idevelopment/serviceforce/commits{/sha}","git_commits_url":"https://api.github.com/repos/idevelopment/serviceforce/git/commits{/sha}","comments_url":"https://api.github.com/repos/idevelopment/serviceforce/comments{/number}","issue_comment_url":"https://api.github.com/repos/idevelopment/serviceforce/issues/comments{/number}","contents_url":"https://api.github.com/repos/idevelopment/serviceforce/contents/{+path}","compare_url":"https://api.github.com/repos/idevelopment/serviceforce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idevelopment/serviceforce/merges","archive_url":"https://api.github.com/repos/idevelopment/serviceforce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idevelopment/serviceforce/downloads","issues_url":"https://api.github.com/repos/idevelopment/serviceforce/issues{/number}","pulls_url":"https://api.github.com/repos/idevelopment/serviceforce/pulls{/number}","milestones_url":"https://api.github.com/repos/idevelopment/serviceforce/milestones{/number}","notifications_url":"https://api.github.com/repos/idevelopment/serviceforce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idevelopment/serviceforce/labels{/name}","releases_url":"https://api.github.com/repos/idevelopment/serviceforce/releases{/id}","deployments_url":"https://api.github.com/repos/idevelopment/serviceforce/deployments","created_at":"2016-05-27T05:17:59Z","updated_at":"2016-08-13T18:59:03Z","pushed_at":"2016-08-13T19:30:49Z","git_url":"git://github.com/idevelopment/serviceforce.git","ssh_url":"git@github.com:idevelopment/serviceforce.git","clone_url":"https://github.com/idevelopment/serviceforce.git","svn_url":"https://github.com/idevelopment/serviceforce","homepage":null,"size":536,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":19,"forks":1,"open_issues":19,"watchers":1,"default_branch":"master"}},"base":{"label":"idevelopment:master","ref":"master","sha":"516595746237e6db09fb1625f03069ed2db4a996","user":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"repo":{"id":59806177,"name":"serviceforce","full_name":"idevelopment/serviceforce","owner":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/idevelopment/serviceforce","description":"","fork":false,"url":"https://api.github.com/repos/idevelopment/serviceforce","forks_url":"https://api.github.com/repos/idevelopment/serviceforce/forks","keys_url":"https://api.github.com/repos/idevelopment/serviceforce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idevelopment/serviceforce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idevelopment/serviceforce/teams","hooks_url":"https://api.github.com/repos/idevelopment/serviceforce/hooks","issue_events_url":"https://api.github.com/repos/idevelopment/serviceforce/issues/events{/number}","events_url":"https://api.github.com/repos/idevelopment/serviceforce/events","assignees_url":"https://api.github.com/repos/idevelopment/serviceforce/assignees{/user}","branches_url":"https://api.github.com/repos/idevelopment/serviceforce/branches{/branch}","tags_url":"https://api.github.com/repos/idevelopment/serviceforce/tags","blobs_url":"https://api.github.com/repos/idevelopment/serviceforce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idevelopment/serviceforce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idevelopment/serviceforce/git/refs{/sha}","trees_url":"https://api.github.com/repos/idevelopment/serviceforce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idevelopment/serviceforce/statuses/{sha}","languages_url":"https://api.github.com/repos/idevelopment/serviceforce/languages","stargazers_url":"https://api.github.com/repos/idevelopment/serviceforce/stargazers","contributors_url":"https://api.github.com/repos/idevelopment/serviceforce/contributors","subscribers_url":"https://api.github.com/repos/idevelopment/serviceforce/subscribers","subscription_url":"https://api.github.com/repos/idevelopment/serviceforce/subscription","commits_url":"https://api.github.com/repos/idevelopment/serviceforce/commits{/sha}","git_commits_url":"https://api.github.com/repos/idevelopment/serviceforce/git/commits{/sha}","comments_url":"https://api.github.com/repos/idevelopment/serviceforce/comments{/number}","issue_comment_url":"https://api.github.com/repos/idevelopment/serviceforce/issues/comments{/number}","contents_url":"https://api.github.com/repos/idevelopment/serviceforce/contents/{+path}","compare_url":"https://api.github.com/repos/idevelopment/serviceforce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idevelopment/serviceforce/merges","archive_url":"https://api.github.com/repos/idevelopment/serviceforce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idevelopment/serviceforce/downloads","issues_url":"https://api.github.com/repos/idevelopment/serviceforce/issues{/number}","pulls_url":"https://api.github.com/repos/idevelopment/serviceforce/pulls{/number}","milestones_url":"https://api.github.com/repos/idevelopment/serviceforce/milestones{/number}","notifications_url":"https://api.github.com/repos/idevelopment/serviceforce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idevelopment/serviceforce/labels{/name}","releases_url":"https://api.github.com/repos/idevelopment/serviceforce/releases{/id}","deployments_url":"https://api.github.com/repos/idevelopment/serviceforce/deployments","created_at":"2016-05-27T05:17:59Z","updated_at":"2016-08-13T18:59:03Z","pushed_at":"2016-08-13T19:30:49Z","git_url":"git://github.com/idevelopment/serviceforce.git","ssh_url":"git@github.com:idevelopment/serviceforce.git","clone_url":"https://github.com/idevelopment/serviceforce.git","svn_url":"https://github.com/idevelopment/serviceforce","homepage":null,"size":536,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":19,"forks":1,"open_issues":19,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68"},"html":{"href":"https://github.com/idevelopment/serviceforce/pull/68"},"issue":{"href":"https://api.github.com/repos/idevelopment/serviceforce/issues/68"},"comments":{"href":"https://api.github.com/repos/idevelopment/serviceforce/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/idevelopment/serviceforce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/idevelopment/serviceforce/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/idevelopment/serviceforce/statuses/f04fbd7d5b90f07e12c8658f6344f175632f0282"}}}}
{"actor":{"display_login":"Nitpick-CI"}}