Skip to content

Commit

Permalink
Update Occurence Bug
Browse files Browse the repository at this point in the history
Update to issues because of Guzzle not allowing a query string
  • Loading branch information
colinhall17 committed Aug 1, 2020
1 parent d00952d commit 3f0e4c9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
34 changes: 18 additions & 16 deletions src/MeetingOccurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
class MeetingOccurrence extends Model
{
protected $updateResource = 'MacsiDigital\Zoom\Requests\UpdateOccurrence';
protected $endPoint = 'meetings';

protected $endPoint = 'meetings/{meeting:id}';

protected $allowedMethods = ['find', 'get', 'patch', 'delete'];

protected $apiDataField = '';

protected $apiMultipleDataField = 'occurrences';
protected $apiMultipleDataField = 'occurrences';

protected $primaryKey = 'occurrence_id';

public function registrants()
{
Expand All @@ -23,30 +25,30 @@ public function registrants()

public function find($id)
{
$occurence = $this->newQuery()->addQuery('occurrence_id', $id)->find($this->meeting_id);
$occurence = $this->newQuery()->addQuery('occurrence_id', $id)->getOne();
$occurence->meeting_id = $this->meeting_id;
$occurence->occurrence_id = $id;
return $occurence;
}

public function beforeUpdating($query)
public function getPatchEndPoint()
{
If(!$this->hasKey()){
return false;
}
return $query->where('occurrence_id', $this->id);
if($this->hasCustomEndPoint('patch')){
return $this->getCustomEndPoint('patch').$this->getKeyForEndPoint();
}
return $this->endPoint.'?occurrence_id='.$this->getKey();
}

public function delete($scheduleForReminder=true)
public function getDeleteEndPoint()
{
return $this->newQuery()->addQuery('schedule_for_reminder', $scheduleForReminder)->delete();
if($this->hasCustomEndPoint('delete')){
return $this->getCustomEndPoint('delete').$this->getKeyForEndPoint();
}
return $this->endPoint.'?occurrence_id='.$this->getKey();
}

public function beforeDeleting($query)
public function delete($scheduleForReminder=true)
{
If(!$this->hasKey()){
return false;
}
return $query->where('occurrence_id', $this->id);
return $this->newQuery()->addQuery('schedule_for_reminder', $scheduleForReminder)->delete();
}
}
31 changes: 17 additions & 14 deletions src/WebinarOccurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
class WebinarOccurrence extends Model
{
protected $updateResource = 'MacsiDigital\Zoom\Requests\UpdateOccurrence';

protected $endPoint = 'webinars/{webinar:id}';

protected $allowedMethods = ['find', 'get', 'patch', 'delete'];

protected $apiDataField = '';

protected $apiMultipleDataField = 'occurrences';
protected $apiMultipleDataField = 'occurrences';

protected $primaryKey = 'occurrence_id';

public function registrants()
{
Expand All @@ -23,30 +25,31 @@ public function registrants()

public function find($id)
{
$occurence = $this->newQuery()->addQuery('occurrence_id', $id)->find($this->webinar_id);
$occurence = $this->newQuery()->addQuery('occurrence_id', $id)->getOne();
$occurence->webinar_id = $this->webinar_id;
$occurence->occurrence_id = $id;
return $occurence;
}

public function beforeUpdating($query)
public function getPatchEndPoint()
{
If(!$this->hasKey()){
return false;
if($this->hasCustomEndPoint('patch')){
return $this->getCustomEndPoint('patch').$this->getKeyForEndPoint();
}
return $query->where('occurrence_id', $this->id);
return $this->endPoint.'?occurrence_id='.$this->getKey();
}

public function delete($scheduleForReminder=true)
public function getDeleteEndPoint()
{
return $this->newQuery()->addQuery('schedule_for_reminder', $scheduleForReminder)->delete();
if($this->hasCustomEndPoint('delete')){
return $this->getCustomEndPoint('delete').$this->getKeyForEndPoint();
}
return $this->endPoint.'?occurrence_id='.$this->getKey();
}

public function beforeDeleting($query)
public function delete($scheduleForReminder=true)
{
If(!$this->hasKey()){
return false;
}
return $query->where('occurrence_id', $this->id);
return $this->newQuery()->addQuery('schedule_for_reminder', $scheduleForReminder)->delete();
}

}

0 comments on commit 3f0e4c9

Please sign in to comment.