File tree Expand file tree Collapse file tree 4 files changed +91
-4
lines changed Expand file tree Collapse file tree 4 files changed +91
-4
lines changed Original file line number Diff line number Diff line change @@ -381,10 +381,12 @@ print $contact_email; // outputs something like "example@domain.com"
381381 |----templateFolders()
382382 |
383383 |----templates()
384- |
385- |----defaultContent()
386-
387-
384+ | |
385+ | |----defaultContent()
386+ |
387+ |----verifiedDomains()
388+ |
389+ |----verify()
388390
389391
390392
Original file line number Diff line number Diff line change @@ -239,6 +239,16 @@ public function templates($template_id = null)
239239 return new Resources \Templates ($ this ->request , $ this ->settings , $ template_id );
240240 }
241241
242+ /**
243+ * @param null $domain_name
244+ *
245+ * @return Resources\VerifiedDomains
246+ */
247+ public function verifiedDomains ($ domain_name = null )
248+ {
249+ return new Resources \VerifiedDomains ($ this ->request , $ this ->settings , $ domain_name );
250+ }
251+
242252 /**
243253 * @param $client_id
244254 * @param $redirect_uri
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace MailchimpAPI \Resources ;
4+
5+
6+ use MailchimpAPI \Requests \MailchimpRequest ;
7+ use MailchimpAPI \Settings \MailchimpSettings ;
8+
9+ /**
10+ * Class VerifiedDomains
11+ * Represents the Verified Domains Mailchimp API endpoint
12+ * @package MailchimpAPI\Resources
13+ */
14+ class VerifiedDomains extends ApiResource
15+ {
16+ /* @var string */
17+ private $ domain_name ;
18+
19+ /**
20+ * The url component for this endpoint
21+ */
22+ const URL_COMPONENT = '/verified-domains/ ' ;
23+
24+ const VERIFY_URL_COMPONENT = '/actions/verify ' ;
25+
26+ /**
27+ * VerifiedDomains constructor.
28+ *
29+ * @param MailchimpRequest $request
30+ * @param MailchimpSettings $settings
31+ * @param null $domain_name
32+ */
33+ public function __construct (MailchimpRequest $ request , MailchimpSettings $ settings , $ domain_name = null )
34+ {
35+ parent ::__construct ($ request , $ settings );
36+ $ request ->appendToEndpoint (self ::URL_COMPONENT . $ domain_name );
37+ $ this ->domain_name = $ domain_name ;
38+ }
39+
40+ /**
41+ * @return \MailchimpAPI\Responses\MailchimpResponse
42+ * @throws \MailchimpAPI\MailchimpException
43+ */
44+ public function verify ()
45+ {
46+ $ this ->throwIfNot ("domain-name " , $ this ->domain_name );
47+ return $ this ->postToActionEndpoint (self ::VERIFY_URL_COMPONENT );
48+ }
49+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace MailchimpTests ;
4+
5+ use MailchimpAPI \Resources \VerifiedDomains ;
6+
7+ class VerifiedDomainsTest extends MailChimpTestCase
8+ {
9+ public function testVerifiedDomainsCollectionEndpoint ()
10+ {
11+ $ this ->endpointUrlBuildTest (
12+ VerifiedDomains::URL_COMPONENT ,
13+ $ this ->mailchimp ->verifiedDomains (),
14+ "The verified domains collection endpoint should be constructed correctly "
15+ );
16+ }
17+
18+ public function testVerifiedDomainsInstanceEndpoint ()
19+ {
20+ $ this ->endpointUrlBuildTest (
21+ VerifiedDomains::URL_COMPONENT . 'my-domain ' ,
22+ $ this ->mailchimp ->verifiedDomains ('my-domain ' ),
23+ "The verified domains instance endpoint should be constructed correctly "
24+ );
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments