Skip to content

Commit

Permalink
Fix comments & readme
Browse files Browse the repository at this point in the history
  • Loading branch information
arnas committed Jan 29, 2024
1 parent 9cd1568 commit c88a7fd
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 12 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
# Omnisend Core Plugin

[Omnisend](https://wordpress.org/plugins/omnisend/) is WordPress plugin that enables to use different [Omnisend marketing automation tool](https://www.omnisend.com/) features
[Omnisend](https://wordpress.org/plugins/omnisend/) is WordPress plugin that enables to use [Omnisend marketing automation tool](https://www.omnisend.com/) features
for WordPress website.

## Plugin features

* Website connection to Omnisend (this enables to use different Omnisend [features](https://www.omnisend.com/features/))
* Website connection to Omnisend [features](https://www.omnisend.com/features/))
* SDK Client to connect other plugins to Omnisend.


## SDK Client

The plugin provides an SDK client to easily integrate with Omnisend API.

> [!IMPORTANT]
> To use this SDK the user must install [wp-omnisend plugin](https://wordpress.org/plugins/wp-omnisend) and connect it to the omnisend.
You can find function references in the [client folder](https://github.com/omnisend/wp-omnisend/tree/main/omnisend/includes/Public/Client/V1).

### Examples

To create a contact:

```php
TBD check if plugin is activated
TBD create client
TBD create contact
TBD send contact
```

## PHP Linting

Expand All @@ -18,7 +40,7 @@ After each push to any branch `PHP Standards` action will run and all the PHP co

Tools needed:

- php (7.4 version is recommended because at the time of writing WordPress coding standards supports only up to 7.4 version);
- php (7.4 version is recommended because at the time of writing WordPress coding standards support only up to 7.4 version);
- composer (can be installed as described in https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos);

After installing those tools one can run in local plugin dir (plugin_woocommerce_api) helper script:
Expand All @@ -35,7 +57,7 @@ composer update
composer install
```

install linting tool and standards. And then actual linting `phpcs` script can be initiated with
install linting tool and standards. Then actual linting `phpcs` script can be initiated with

```shell
./vendor/squizlabs/php_codesniffer/bin/phpcs --ignore=.js --standard=WordPress omnisend-connect
Expand Down
25 changes: 25 additions & 0 deletions omnisend/includes/Public/Client/V1/a.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Omnisend Client
*
* @package OmnisendClient
*/




$contact = new OmnisendContact();
$contact->setEmail('[email protected]');
$contact->setFirstName('John');
$contact->setLastName('Doe');

// Send the contact to Omnisend
$apiClient = new Omnisend\ApiClient('YOUR_API_KEY');
$response = $apiClient->createContact($contact);

// Check the response
if ($response->isSuccess()) {
echo 'Contact created and sent to Omnisend successfully.';
} else {
echo 'Failed to create and send contact to Omnisend. Error: ' . $response->getErrorMessage();
}
4 changes: 0 additions & 4 deletions omnisend/includes/Public/Client/V1/class-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
class Client {

/**
* Check if plugin is connected to Omnisend account.
*
* Check and return if plugin connected to Omnisend account. If connection does not exist, it will not be possible
* to send data to Omnisend.
*
Expand All @@ -32,8 +30,6 @@ public static function is_connected(): bool {
}

/**
* Create contact in Omnisend
*
* Create a contact in Omnisend. For it to succeed ensure that provided contact at least have email or phone number.
*
* @param Contact $contact
Expand Down
8 changes: 4 additions & 4 deletions omnisend/includes/Public/Client/V1/class-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static function is_valid_custom_property_name( $name ): bool {
}

/**
* Validate custom property tag.
* Validate tag.
*
* @param $tags
* @param $tag
*
* @return bool
*/
Expand All @@ -34,9 +34,9 @@ public static function is_valid_tag( $tag ): bool {
}

/**
* Clean up custom property name.
* Clean up tag name.
*
* @param $tags
* @param $tag
*
* @return string
*/
Expand Down

0 comments on commit c88a7fd

Please sign in to comment.