2017 © Pedro Peláez
 

library parse-promos

Parse promotion arrays from the Wayne State University API

image

waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  • Wednesday, March 14, 2018
  • by nickdenardis
  • Repository
  • 3 Watchers
  • 0 Stars
  • 12,418 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 20 Versions
  • 6 % Grown

The README.md

ParsePromos Class

Parse promotion arrays from the Wayne State University API, (*1)

Latest Stable Version Build Status Total Downloads License, (*2)

Installation

To install this library, run the command below and you will get the latest version, (*3)

composer require waynestate/parse-promos

Usage

Create the object, (*4)

use Waynestate\Promotions\ParsePromos;

...

$parsePromos = new Waynestate\Promotions\ParsePromos();

Make an API call for promotions, (*5)

// Promotion groups to pull ( id => short_name )
$group_reference = [
    123 => 'circle',
    124 => 'alumni-links',
    125 => 'contact',
    126 => 'progress-amount',
    127 => 'progress-text',
];

// How to parse each group after the return ( short_name => config_option )
$group_config = [
    'contact' => 'first',
    'progress-amount' => 'limit:1',
    'progress-text' => 'randomize|first',
];

// Pull all the active items from the API
$params = [
    'promo_group_id' => array_keys($group_reference),
    'is_active' => '1',
    'ttl' => TTL,
];

// Get the raw promotions from the API
$raw_promos = $api->sendRequest('cms.promotions.listing', $params);

// Parse the promotions based on the config set
$parsed_promos = $parsePromos->parse($raw_promos, $group_reference, $group_config);

Config options, (*6)

'first' = Return only the first item in the list (not part of an array)
'randomize' = Take the returned list and mix it up
'limit:#' = Return just # number of results from the list
'order:start_date_desc' = Return an ordered list by 'start_date' DESC
'order:start_date_asc' = Return an ordered list by 'start_date' ASC
'order:display_date_desc' = Return an ordered list by 'display_date' DESC
'order:display_date_asc' = Return an ordered list by 'display_date' ASC
'order:title_desc' = Return an ordered list by 'title' DESC
'order:title_asc' = Return an ordered list by 'title' ASC
'page_id:#' = Return only promotions in the list marked for this page
'youtube' = Parse the 'link' field for YouTube video ID, place in a new 'video_id' field

'order:start_date_desc|first' = Options can be run in combination by piping to another config

Tests, (*7)

phpunit

Code Coverage, (*8)

phpunit --coverage-html ./coverage

The Versions

14/03 2018

dev-develop

dev-develop http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

 

The Development Requires

array parse

14/03 2018

dev-master

9999999-dev http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

 

The Development Requires

array parse

14/03 2018

2.0.0

2.0.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

 

The Development Requires

array parse

14/03 2018

dev-release/2.0.0

dev-release/2.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

 

The Development Requires

array parse

14/03 2018

dev-feature/youtube-urls

dev-feature/youtube-urls http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

 

The Development Requires

array parse

14/02 2018

1.2.0

1.2.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

array parse

14/02 2018

dev-hotfix/1.2.0

dev-hotfix/1.2.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

array parse

05/12 2017

1.1.0

1.1.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

array parse

05/12 2017

dev-hotfix/1.1.0

dev-hotfix/1.1.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

array parse

05/12 2017

1.0.2

1.0.2.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

08/07 2017

dev-hotfix/1.0.2

dev-hotfix/1.0.2 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

10/10 2016

1.0.1

1.0.1.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

19/02 2016

1.0.0

1.0.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

18/02 2016

0.2.0

0.2.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

25/11 2015

0.1.4

0.1.4.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

13/09 2014

0.1.3

0.1.3.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

11/09 2014

0.1.2

0.1.2.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

06/09 2014

0.1.1

0.1.1.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

06/09 2014

0.1.0

0.1.0.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

array parse

04/09 2014

0.0.1

0.0.1.0 http://github.com/waynestate/parse-promos

Parse promotion arrays from the Wayne State University API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

array parse