Skip to content

Conversation

@latanasov
Copy link
Contributor

No description provided.

@latanasov latanasov requested a review from Nightbr August 15, 2017 14:59
Copy link
Member

@Nightbr Nightbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should create a full documentation (like Symfony MailjetBundle) using mkdocs and create github pages for the full documentation.

README.md Outdated
...
Mailjet\LaravelMailjet\MailjetServiceProvider::class,
Mailjet\LaravelMailjet\MailjetMailServiceProvider::class,
Mailjet\LaravelMailjet\Providers\MailjetServiceProvider::class,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a CHANGELOG for this BC-change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, by the way I have for the moment left the Facade, for MailjetServiceProvider and implemented a separate (new) contract + service provider. Do you think I should just leave MailjetServiceProvider in the old namespace, to avoid breaking changes ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I think we should not change this for retro-compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I'll leave the old facade and provider as it was and let the user choose between facade/contract approach.

* @param array $property
* @return Properties
*/
public function removeOptionalProperty($property) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's many properties which can be unset by a single call to this function, the parameter should better be plural, properties?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also use type array in parameters
public function removeOptionalProperty(array $property) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my "mind" the method was there for adding a single property,but ok.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so let it this way. Make sense to add or remove only one property at time

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the PHP doc above states it's an array, plus it loops on items

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the loop is to delete the right item

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs is wrong @return Properties should have been the array. Note I implement setOptionalProperties for multiple properties and addOptionalProperty for single property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you want to add a property you do this:

$campaign->addOptionalProperty(array("key"=>"value"));

same thing when you want to remove:

$campaign->removeOptionalProperty(array("key"=>"value"));

that's why it's and array in parameter...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you are right

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise you could do this:

public function addOptionalProperty($key, $value)

and
public function removeOptionalProperty($key)

protected $properties;
protected $action;

public function __construct($email, $name = null, array $properties = [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not follow same naming convention than other model, which is optionalProperties?

If name is optional, why put it in the constructor?

}

if (!is_null($this->properties)) {
#$result[self::PROPERTIES_KEY] = $this->removeNullProperties($this->properties);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To delete?

const EVENT_TYPE_SPAM = 'spam';
const EVENT_TYPE_BLOCKED = 'blocked';
const EVENT_TYPE_UNSUB = 'unsub';
const EVENT_TYPE_TYPOFIX = 'typofix';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated

Copy link
Member

@Nightbr Nightbr Aug 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all const, I think the best is to implement const into the wrapper and use them in all libraries. Look at this issue mailjet/mailjet-apiv3-php#82

const EVENT_TYPE_UNSUB = 'unsub';
const EVENT_TYPE_TYPOFIX = 'typofix';
const EVENT_TYPE_SENT = 'sent';
const EVENT_TYPE_PARSEAPI = 'parseapi';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated

$contact->setAction(Contact::ACTION_UNSUB);
$response = $this->_exec($listId, $contact);
if (!$response->success()) {
$this->throwError("ContactsListManager:unsub() failed", $response);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method is named unsubscribe

}
$response = $this->_exec($listId, $contact);
if (!$response->success()) {
$this->throwError("ContactsListManager:sub() failed", $response);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method is named subscribe

* @param Contact $contact
* @param string $action
*/
public function create($listId, Contact $contact, $action=Contact::ACTION_ADDFORCE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing, I would expect it to create a contact list

* @param Contact $contact
* @param string $oldEmail
*/
public function changeEmail($listId, Contact $contact, $oldEmail)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update sounds better than change?

{
$batchResults = [];
// we send multiple smaller requests instead of a bigger one
$contactChunks = array_chunk($contactsList->getContacts(), self::CONTACT_BATCH_SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API will always return up to 1000 (default value for self::CONTACT_BATCH_SIZE). You then will always send one request. Plus I don't see pagination to handle lists bigger than 1000s contacts?

public function __construct($email, array $optionalProperties = [])
{
$this->email = $email;
$this->name = $name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$name doesn't exist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch thanks @Nightbr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@Nightbr Nightbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not commit built documentation and non-related files (screenshot of mailjetBundle Symfony)

@Nightbr
Copy link
Member

Nightbr commented Aug 21, 2017

The structure Resources/doc is a Symfony related structure you should not use it for Laravel Package also, remove Resources/config which is Symfony related.

I recommand you create a doc folder at root of the project:

src/
doc/
...

Where you will put the documentation.

@latanasov
Copy link
Contributor Author

Hi @Nightbr thanks for feedback, I did not know it was Symfony Specific.

@Nightbr
Copy link
Member

Nightbr commented Aug 21, 2017

Some reviews:

  • Retrieve the content of the contributing at root
  • Remove Automation (FR) link into the mailjet-doc
  • fix test documentation (we use phpunit here not phpspec)

@Nightbr
Copy link
Member

Nightbr commented Aug 21, 2017

You can also add a badge to the README.md

[![Documentation](https://img.shields.io/badge/documentation-gh--pages-blue.svg)](https://mailjet.github.io/laravel-mailjet/)

@Nightbr
Copy link
Member

Nightbr commented Aug 25, 2017

Love the Mailjet Mkdocs theme! It's pretty neat!

@latanasov latanasov merged commit bdaa487 into master Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants