2017 © Pedro Peláez
 

library nikeandphp

A PHP library used to work with Nike+ API

image

nikhilkuria/nikeandphp

A PHP library used to work with Nike+ API

  • Saturday, March 18, 2017
  • by nikhilkuria
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

nikeandphp

Build Status Latest Stable Version, (*1)

nikeandphp is a php package used to retrive information from the Nike+ APIs. The library is hosted under Packagist https://packagist.org/packages/nikhilkuria/nikeandphp, (*2)

The APIs are generally closed and have a history of sudden changes. If you feel anything broken or does not seem to work as it is supposed to, please raise a bug and we will have a look at it as soon as we can., (*3)

The prime interface which exposes the data from Nike+ is NikeService Use the static factory method to get an instance of NikeService. The facory method expects the username and password of your Nike+ account., (*4)

$nikeService = BasicNikeService::createWithCredentials($userName,$passWord);

Once you have the NikeService, you can directly call the methods which are exposed., (*5)

  • Get a summary of the acitivites
  • Get the entire list of runs

Get the summary

$summary = $nikeService->getSummary();

This would give an object corresponding to the JSON, (*6)

{
  "links": [
    {
      "rel": "self",
      "href": "https://api.nike.com/v1/me/sport"
    },
    {
      "rel": "activities",
      "href": "https://api.nike.com/v1/me/sport/activities"
    }
  ],
  "experienceTypes": [
    "RUNNING"
  ],
  "summaries": [
    {
      "experienceType": "ALL",
      "records": [
        {
          "recordType": "LIFETIMEFUEL",
          "recordValue": "581652"
        }
      ]
    },
    {
      "experienceType": "RUNNING",
      "records": [
        {
          "recordType": "LIFETIMEFUEL",
          "recordValue": "585162"
        },
        {
          "recordType": "LEVEL",
          "recordValue": "11"
        },
        {
          "recordType": "LIFETIMEDISTANCE",
          "recordValue": "2267.7218332193397"
        },
        {
          "recordType": "LIFETIMEDURATION",
          "recordValue": "221:44:03.876"
        },
        {
          "recordType": "LIFETIMEAVERAGEPACE",
          "recordValue": "298571.4120103049"
        },
        {
          "recordType": "LONGESTRUNDISTANCE",
          "recordValue": "21.58303"
        }
      ]
    }
  ]
}

Get Runs

$lastRecords = $nikeService->getRuns(10, true);

This takes in two params * num of runs * boolean to summarize the runs or not (defaults to false), (*7)

An unsummarized run request will return an object corresponding to the php object for this Json, (*8)

{
  "data": [
    {
      "links": [
        {
          "rel": "self",
          "href": "https://api.nike.com/v1/me/sport/activities/7320000000003216744510001903729471141578"
        }
      ],
      "activityId": "7320000000003216744510001903729471141578",
      "activityType": "RUN",
      "startTime": "2017-03-17T15:20:59Z",
      "activityTimeZone": "Asia/Kolkata",
      "status": "COMPLETE",
      "deviceType": "OTHER",
      "metricSummary": {
        "calories": "166",
        "fuel": "521",
        "distance": "2.026179075241089",
        "steps": "1853",
        "duration": "0:12:25.861"
      },
      "tags": [
        {
          "tagType": "LOCATION",
          "tagValue": "OUTDOORS"
        },
        {
          "tagType": "SHOES",
          "tagValue": "Nike Free 5.0"
        }
      ],
      "metrics": []
    }
  ],
  "paging": {
    "next": "/v1/me/sport/activities/RUNNING?count=1&access_token=qZDE3FwVxhDu6VPVY2ajcct0g35f&offset=2",
    "previous": null
  }
}

The Versions

18/03 2017

dev-master

9999999-dev

A PHP library used to work with Nike+ API

  Sources   Download

The Requires

 

The Development Requires

by Avatar nikhilkuria

28/02 2017

v0.0.3.x-dev

0.0.3.9999999-dev

A PHP library used to work with Nike+ API

  Sources   Download

The Requires

 

The Development Requires

by Avatar nikhilkuria

21/02 2017

v0.0.2

0.0.2.0

A PHP library used to work with Nike+ API

  Sources   Download

The Requires

 

by Avatar nikhilkuria

15/02 2017

v0.0.1

0.0.1.0

A PHP library used to work with Nike+ API

  Sources   Download

The Requires

 

by Avatar nikhilkuria