Giter Club home page Giter Club logo

cakephp-mediapost's Introduction

CakePHP MediaPost Datasource

With this datasource, you can easily manage some functionalities of MediaPost.

It uses the Diego Matos MediaPost-API.

Configuration

Save in the folder app/Plugin/MediaPost, with git clone or downloading the zip source; Load plugin in app/Config/bootstrap.php:

CakePlugin::load('MediaPost');

Use the bootstrap.sample.php to configure consumerKey, consumerSecret, token and tokenSecret; or place in app/Config/bootstrap.php:

Configure::write('MediaPost', array(
  'consumerKey' => 'consumer-key-here',
  'consumerSecret' => 'consumer-secret-here',
  'token' => 'token-here',
  'tokenSecret' => 'token-secret-here'
));

Place in app/Config/database.php:

public $mediapost = array(
     'datasource' => 'MediaPost.MediaPostSource'
);

Usage Example

Lists

// load model
public $uses = array(
     'MediaPost.MediaPostList',
);
// or in your action
$this->loadModel('MediaPost.MediaPostList');

// Retrieve lists
$lists = $this->MediaPostList->find('all');

// Retrieve a list by id/code
$list = $this->MediaPostList->find('first', array(
	'conditions' => array('id' => 1)
));

// Save one list
$this->MediaPostList->save(
	array(
		'MediaPostList' => array(
			 // If the code is passed, the registry is updated in MediaPost
			 'cod' => 1,
	         'nome' => 'List Name',
		)
	)
);

// Save many
$this->MediaPostList->saveMany(array(
	array(
		'MediaPostList' => array(
			 'cod' => 1,
	         'nome' => List Name 1
		)
	),
	array(
		'MediaPostList' => array(
			 'cod' => 1,
	         'nome' => 'List Name 2'
		)
	),
));

Contacts

// load model
public $uses = array(
     'MediaPost.MediaPostContact',
);
// or in your action
$this->loadModel('MediaPost.MediaPostContact');

// List contact available fields
$fields = $this->MediaPostContact->find('all', array(
	'conditions' => array('fields' => true)
));

// Find by contact id/code
$contact = $this->MediaPostContact->find('first', array(
	'conditions' => array(
		'id' => 1
	)
));

// Find by contact email
$contact = $this->MediaPostContact->find('first', array(
	'conditions' => array(
		'email' => '[email protected]'
	)
));

// Save one contact
$this->MediaPostContact->save(
	array(
		'MediaPostContact' => array(
			 'lista' => 1,
	         'nome' => 'John Doe',
	         'email' => '[email protected]'
		)
	)
);

// Save many
$this->MediaPostContact->saveMany(array(
	array(
		'MediaPostContact' => array(
			 'lista' => 1,
	         'nome' => 'John Doe',
	         'email' => '[email protected]'
		)
	),
	array(
		'MediaPostContact' => array(
			 'lista' => 1,
	         'nome' => 'Edgar Allen',
	         'email' => '[email protected]'
		)
	),
));

// Delete a Contact
$this->MediaPostContact->delete(1);

Message

// load model
public $uses = array(
     'MediaPost.MediaPostMessage',
);
// or in your action
$this->loadModel('MediaPost.MediaPostMessage');

// Create/Save a message
 $this->MediaPostMessage->save(array(
    'uidcli' => 123, // Your system code, used to reference only
 	// If code is passed, the message will be updated
	'cod' => 1,
	'pasta' => 'Campaign Name'
    'nome_remetente' => 'John Doe',
    'email_remetente' => '[email protected]',
    'assunto' => 'Send test',
    'mensagem' => "<i>Example</i> of a message, with some <strong>HTML</strong> inside."
 ));


// Send a message
// Ex.: $this->MediaPostMessage->send($messageId, $listId, $filters = array());
$this->MediaPostMessage->send(5, 4, array(
	'nome' => 'Jonh'
));

cakephp-mediapost's People

Contributors

lsantosc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.