Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yehuda committed May 16, 2019
2 parents 09ad011 + a163c98 commit f61b0f4
Show file tree
Hide file tree
Showing 47 changed files with 6,822 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Postman/Postman-Mail/sendgrid/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test/coverage/*
examples/*
dist/
composer.lock
vendor
vendor/**/test/*
vendor/**/*.md
vendor/**/*.sh
vendor/**/*.yml
.env*
sendgrid-php.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.


Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
e.g.
Fixes #1
Closes #2
-->
# Fixes #

### Checklist
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
- [ ] I have read the [Contribution Guide] and my PR follows them.
- [ ] I updated my branch with the master branch.
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation about the functionality in the appropriate .md file
- [ ] I have added in line documentation to the code I modified

### Short description of what this PR does:
-
-

If you have questions, please send an email to [Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM php:7.1-apache

ARG sendgrid_apikey
ENV SENDGRID_API_KEY=$sendgrid_apikey

COPY . /var/www/client
WORKDIR /var/www/client

RUN apt-get update && \
apt-get install -y git zip zlib1g-dev && docker-php-ext-install zip
RUN curl --silent --show-error https://getcomposer.org/installer | php

RUN php composer.phar install
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines given above, then fill out the blanks below.

**All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.**

Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged!
e.g.
Fixes #1
Closes #2
-->
# Fixes #

### Checklist
- [ ] I acknowledge that all my contributions will be made under the project's license
- [ ] I have made a material change to the repo (functionality, testing, spelling, grammar)
- [ ] I have read the [Contribution Guide] and my PR follows them.
- [ ] I updated my branch with the development branch.
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation about the functionality in the appropriate .md file
- [ ] I have added in line documentation to the code I modified

### Short description of what this PR does:
-
-

If you have questions, please send an email to [Twilio Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM php:7.1-cli

ENV OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"
ENV SENDGRID_API_KEY $SENDGRID_API_KEY

# install Prism
WORKDIR /root

# install Prism
ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh
RUN chmod +x ./install.sh && sync && \
./install.sh && \
rm ./install.sh

# set up default Twilio SendGrid env
WORKDIR /root

RUN mkdir sendgrid-php
COPY entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
CMD ["--mock"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* This helper builds a recipient for a /mail/send API call
*
* PHP Version - 5.6, 7.0, 7.1, 7.2
*
* @package SendGrid\Contacts
* @author Kraig Hufstedler <kraigory@gmail.com>
* @copyright 2018-19 Twilio SendGrid
* @license https://opensource.org/licenses/MIT The MIT License
* @version GIT: <git_id>
* @link http://packagist.org/packages/sendgrid/sendgrid
*/

namespace SendGrid\Contacts;
/**
* This class is used to construct a recipient for the /mail/send API call
*
* @package SendGrid\Mail
*/
class Recipient implements \JsonSerializable
{
/** @var $firstName string First name of the email recipient */
private $firstName;
/** @var $lastName string Last name of the email recipient */
private $lastName;
/** @var $email string Email address of the recipient */
private $email;

/**
* Create a recipient for the /mail/send API call
*
* @param string $firstName First name of the email recipient
* @param string $lastName Last name of the email recipient
* @param string $email Email address of the recipient
*/
public function __construct($firstName, $lastName, $email)
{
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->email = $email;
}

/**
* Retrieve the first name of the recipient
*
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}

/**
* Retrieve the last name of the recipient
*
* @return string
*/
public function getLastName()
{
return $this->lastName;
}

/**
* Retrieve the email address of the recipient
*
* @return string
*/
public function getEmail()
{
return $this->email;
}

/**
* Return an array representing a recipient object for the Twilio SendGrid API
*
* @return null|array
*/
public function jsonSerialize()
{
return array_filter(
[
'email' => $this->getEmail(),
'first_name' => $this->getFirstName(),
'last_name' => $this->getLastName()
],
function ($value) {
return $value !== null;
}
) ?: null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* This helper builds a html form and provides a submission endpoint
* for the form that makes a /contactdb/recipients API call.
*
* PHP Version - 5.6, 7.0, 7.1, 7.2
*
* @package SendGrid\Contacts
* @author Kraig Hufstedler <kraigory@gmail.com>
* @copyright 2018-19 Twilio SendGrid
* @license https://opensource.org/licenses/MIT The MIT License
* @version GIT: <git_id>
* @link http://packagist.org/packages/sendgrid/sendgrid
*/

namespace SendGrid\Contacts;

/**
* This class is used to build a html form and provides a submission
* endpoint for the form that makes a /contactdb/recipients API call.
*
* @package SendGrid\Contacts
*/
class RecipientForm
{
/** @var $html string HTML content for the form */
private $html;

/**
* Form constructor
*
* @param string $url The url the form should submit to
*/
public function __construct($url)
{
$html = '<form action="' . $url . '" method="post">
First Name: <input type="text" name="first-name"><br>
Last Name: <input type="text" name="last-name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>';
$this->html = $html;
}

/**
* Return the HTML form
*
* @return string
*/
public function __toString()
{
return $this->html;
}

}
Loading

0 comments on commit f61b0f4

Please sign in to comment.