Skip to content

Commit 497fd78

Browse files
authored
Merge pull request #142 from phpminds/develop
Use meetup OAuth client
2 parents b8f5afc + ce70118 commit 497fd78

15 files changed

Lines changed: 308 additions & 172 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: php
22
php: '7.1'
33
install: composer install
4-
script: phpunit --configuration tests/phpunit/phpunit.xml
4+
script: bin/phpunit --configuration tests/phpunit/phpunit.xml
55

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,6 @@ Integrations with
2020
- [x] meetup.com
2121
- [x] joind.in
2222

23-
24-
## Tests
25-
26-
Running Behat:
27-
28-
`bin/behat -c tests/behat/behat.yml `
29-
-Running everything without the browser:
30-
-
31-
-`/bin/behat -c tests/behat/behat.yml --tags ~@javascript
32-
-`
33-
-
34-
-Running Selenium:
35-
-
36-
-`java -Dwebdriver.chrome.driver=./tests/drivers/linux/chromedriver -jar ./vendor/se/selenium-server-standalone/bin/selenium-server-standalone.jar -port 4444`
37-
-
38-
-*Server Dependencies*
39-
-
40-
-Java 8
41-
-
42-
-Installation
43-
-
44-
-```
45-
-add-apt-repository ppa:webupd8team/java
46-
-apt update
47-
-apt install oracle-java8-installer
48-
-```
49-
-
50-
5123
## Contributors
5224
Created by the @phpminds team - contributions welcomed
5325

app/configs/settings.php.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ return [
3030

3131
'meetups' => [
3232
"apiKey" => "add-your-key-here",
33+
'consumerKey' => 'THE-CONSUMER-KEY',
34+
'consumerSecret' => 'THE-CONSUMER-SECRET',
3335
"baseUrl" => "https://api.meetup.com/2",
3436
"publish_status" => 'draft', // always draft for Development
3537
"PHPMinds" => ["group_urlname" => "PHPMiNDS-in-Nottingham"]

app/dependencies.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,14 @@
8787

8888
$options = array('path' => __DIR__ . '/../cache/');
8989
$driver = new FileSystem($options);
90-
$client = new MeetupCache( \DMS\Service\Meetup\MeetupKeyAuthClient::factory(
91-
[
92-
'key' => $c->get('meetup.config')->apiKey,
93-
'base_url' => $c->get('meetup.config')->baseUrl,
94-
'group_urlname' => $c->get('meetup.config')->groupUrlName,
95-
'publish_status' => $c->get('meetup.config')->publishStatus
96-
]
97-
), new \Stash\Pool($driver));
90+
$meetupClient = \DMS\Service\Meetup\MeetupOAuthClient::factory([
91+
'consumer_key' => $c->get('meetup.config')->consumerKey,
92+
'consumer_secret' => $c->get('meetup.config')->consumerSecret,
93+
]);
94+
$meetupCacheClient = new MeetupCache($meetupClient, new \Stash\Pool($driver));
95+
9896
return new \PHPMinds\Service\MeetupService(
99-
$client,
97+
$meetupCacheClient,
10098
$c->get('meetup.event'),
10199
$c->get('meetup.config')
102100
);

app/src/Action/HomeAction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ public function __construct(Twig $view, LoggerInterface $logger, EventsService $
4747
public function dispatch($request, $response, $args)
4848
{
4949
$event = null;
50-
$eventExists = true;
5150
$previousEvents = null;
5251
try {
5352

5453
$event = $this->eventService->getLatestEvent();
5554

55+
$eventExists = strlen($event->getDescription()) > 0 ?? false;
56+
5657
$previousEvents = $this->eventService->getPastEvents();
5758

5859
$response = $this->cache->withETag($response, $event->getMeetupID());

app/src/Model/Event/Entity/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Event
2222

2323
private $meetupDate;
2424

25-
public function __construct($meetupID, $meetupVenueID, $joindinEventName, $joindinTalkID, $joindinURL, $speakerID, $supporterID, \DateTime $meetupDate)
25+
public function __construct($meetupID, $meetupVenueID, $joindinEventName, $joindinTalkID, $joindinURL, $speakerID, $supporterID, ?\DateTime $meetupDate)
2626
{
2727
$this->meetupID = $meetupID;
2828
$this->meetupVenueID = $meetupVenueID;

app/src/Repository/EventsRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public function getAllEventDetails()
122122
. ', supp.email AS supporter_email, supp.logo AS supporter_logo'
123123
. " FROM {$this->table} AS ev"
124124
. " LEFT JOIN `speakers` AS sp ON sp.id = ev.speaker_id"
125-
. " LEFT JOIN `supporters` AS supp ON supp.id = ev.supporter_id";
126-
125+
. " LEFT JOIN `supporters` AS supp ON supp.id = ev.supporter_id"
126+
. " ORDER BY ev.`meetup_date` DESC";
127127

128128
$stmt = $this->db->prepare($sql);
129129

app/src/Service/EventsService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getEventById($eventID = null)
9191
}
9292

9393
/**
94-
* @return \PHPMinds\Model\Event\EventModel
94+
* @return array
9595
*/
9696
public function getAll()
9797
{

app/src/Service/MeetupService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MeetupService
1313
{
1414

1515
/**
16-
* @var MeetupKeyAuthClient
16+
* @var MeetupCache
1717
*/
1818
protected $client;
1919

app/templates/home.twig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
</div>
2323
{% else %}
2424
<div class="p-summary">
25-
<h3>
26-
There are no published events. Please check again soon.
27-
</h3>
25+
<p>
26+
There are no details for the next event at the moment. Please check again soon. Or drop along to meetup
27+
to find out future dates and or events.
28+
</p>
29+
<p class="right"><a class="button alert" href="https://www.meetup.com/PHPMiNDS-in-Nottingham">Visit Meetup</a></p>
2830
</div>
2931
{% endif %}
3032
</div>

0 commit comments

Comments
 (0)