Skip to content
This repository was archived by the owner on Dec 16, 2021. It is now read-only.

Commit e7ef384

Browse files
committed
Merge pull request #131 from katzwebservices/eventspot
Add EventSpot Components
2 parents 687a61e + ea7e12e commit e7ef384

23 files changed

+2111
-1
lines changed

src/Ctct/Auth/CtctOAuth2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function getAccessToken($code) {
8484
*/
8585
private function convertException($exception) {
8686
$oauth2Exception = new OAuth2Exception($exception->getResponse()->getReasonPhrase(), $exception->getCode());
87-
$oauth2Exception->setErrors(json_decode($exception->getResponse()->getBody()->getContents()));
87+
$oauth2Exception->setErrors(json_decode($exception->getResponse()->getBody()->getContents(), true));
8888
return $oauth2Exception;
8989
}
9090

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?php
2+
namespace Ctct\Components\EventSpot;
3+
4+
use Ctct\Components\Component;
5+
6+
/**
7+
* Represents a single Address of a Payment
8+
*
9+
* @package Components
10+
* @subpackage EventSpot
11+
* @author Constant Contact
12+
*/
13+
class Address extends Component
14+
{
15+
/**
16+
* City info for this address
17+
* @var string
18+
*/
19+
public $city;
20+
21+
/**
22+
* Country of the event location
23+
* @var string (128)
24+
*/
25+
public $country;
26+
27+
/**
28+
* Standard 2 letter ISO 3166-1 code of the country associated with the event address
29+
* @var string (2)
30+
*/
31+
public $country_code;
32+
33+
/**
34+
* Latitude coordinates of the event location
35+
* @var float
36+
*/
37+
public $latitude;
38+
39+
/**
40+
* Line 1 of the address
41+
* @var string
42+
*/
43+
public $line1;
44+
45+
/**
46+
* Line 2 of the address
47+
* @var string
48+
*/
49+
public $line2;
50+
51+
/**
52+
* Line 3 of the address
53+
* @var string
54+
*/
55+
public $line3;
56+
57+
/**
58+
* Longitude coordinates of the event location
59+
* @var float
60+
*/
61+
public $longitude;
62+
63+
/**
64+
* Postal ZIP code for the event
65+
* @var string (25)
66+
*/
67+
public $postal_code;
68+
69+
/**
70+
* The state for this address (non-US/Canada)
71+
* @var string (50)
72+
*/
73+
public $state;
74+
75+
/**
76+
* The state code for this address
77+
* @var string (50)
78+
*/
79+
public $state_code;
80+
81+
82+
/**
83+
* Factory method to create an Address object from an array
84+
* @param array $props - Associative array of initial properties to set
85+
* @return Address
86+
*/
87+
public static function create(array $props)
88+
{
89+
$address = new Address();
90+
$address->id = parent::getValue($props, "id");
91+
$address->line1 = parent::getValue($props, "line1");
92+
$address->line2 = parent::getValue($props, "line2");
93+
$address->line3 = parent::getValue($props, "line3");
94+
$address->city = parent::getValue($props, "city");
95+
$address->address_type = parent::getValue($props, "address_type");
96+
$address->state_code = parent::getValue($props, "state_code");
97+
$address->state = parent::getValue($props, "state");
98+
$address->country_code = parent::getValue($props, "country_code");
99+
$address->postal_code = parent::getValue($props, "postal_code");
100+
$address->sub_postal_code = parent::getValue($props, "sub_postal_code");
101+
return $address;
102+
}
103+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
namespace Ctct\Components\EventSpot;
3+
4+
use Ctct\Components\Component;
5+
6+
/**
7+
* Represents the event Contact
8+
*
9+
* @package Components
10+
* @subpackage EventSpot
11+
* @author Katz Web Services, Inc.
12+
*/
13+
class Contact extends Component
14+
{
15+
/**
16+
* @var string
17+
*/
18+
public $email_address;
19+
20+
/**
21+
* @var string (100)
22+
*/
23+
public $name;
24+
25+
/**
26+
* @var string (100)
27+
*/
28+
public $organization_name;
29+
30+
/**
31+
* @var string
32+
*/
33+
public $phone_number;
34+
35+
/**
36+
* Factory method to create a Contact object from an array
37+
* @param array $props - Associative array of initial properties to set
38+
* @return Contact
39+
*/
40+
public static function create(array $props)
41+
{
42+
$guest = new Contact();
43+
$guest->email_address = parent::getValue($props, "email_address");
44+
$guest->name = parent::getValue($props, "name");
45+
$guest->organization_name = parent::getValue($props, "organization_name");
46+
$guest->phone_number = parent::getValue($props, "phone_number");
47+
48+
return $guest;
49+
}
50+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
namespace Ctct\Components\EventSpot;
3+
4+
use Ctct\Components\Component;
5+
6+
/**
7+
* Represents a single Contact List
8+
*
9+
* @package Components
10+
* @subpackage Contacts
11+
* @author Katz Web Services, Inc.
12+
*/
13+
class EventFee extends Component
14+
{
15+
/**
16+
* Unique identifier of the contact list
17+
* @var string (50) Unique ID for that fee
18+
*/
19+
public $id;
20+
21+
/**
22+
* Fee for registrations that occur prior to the event's early_fee_date
23+
* @var string (100) Fee description displayed to event registrants, each label must be unique
24+
*/
25+
public $label;
26+
27+
/**
28+
* Specifies who the fee applies to:
29+
* BOTH - Fee applies to Registrants and Guests
30+
* REGISTRANTS - Fee applies to registrants only
31+
* GUESTS - Fee applies to guests only
32+
* @var integer
33+
*/
34+
public $fee_scope;
35+
36+
/**
37+
* The fee amount
38+
* @var float
39+
*/
40+
public $fee;
41+
42+
/**
43+
* The event title, visible to registrants
44+
* @var string (100)
45+
*/
46+
public $early_fee;
47+
48+
/**
49+
* Fee for registrations that occur after the event's late_fee_date
50+
* @var float
51+
*/
52+
public $late_fee;
53+
54+
/**
55+
* If true, fee is not displayed on registration page, and is available only to registrants who have a special promocode linked to this fee.
56+
* @see RegistrantPromoCode
57+
* @var bool
58+
*/
59+
public $has_restricted_access = false;
60+
61+
/**
62+
* Factory method to create a EventList object from an array
63+
* @param array $props - Associative array of initial properties to set
64+
* @return EventFee
65+
*/
66+
public static function create(array $props)
67+
{
68+
$event_fee = new EventFee( $props );
69+
$event_fee->id = parent::getValue($props, "id");
70+
$event_fee->label = parent::getValue($props, "label");
71+
$event_fee->fee = parent::getValue($props, "fee");
72+
$event_fee->fee_scope = parent::getValue($props, "fee_scope");
73+
$event_fee->early_fee = parent::getValue($props, "early_fee");
74+
$event_fee->late_fee = parent::getValue($props, "late_fee");
75+
$event_fee->has_restricted_access = parent::getValue($props, "has_restricted_access");
76+
77+
return $event_fee;
78+
}
79+
80+
public function toJson()
81+
{
82+
return json_encode($this);
83+
}
84+
}

0 commit comments

Comments
 (0)