Skip to content

Commit

Permalink
Fixed user request
Browse files Browse the repository at this point in the history
  • Loading branch information
Y0lk committed Apr 14, 2016
1 parent 394c22d commit 5e3b9c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Etsy Provider for OAuth 1.0 Client

[![Latest Stable Version](https://img.shields.io/packagist/v/y0lk/oauth1-etsy.svg)](https://packagist.org/packages/y0lk/oauth1-etsy)
[![Build Status](https://img.shields.io/travis/y0lk/oauth1-etsy.svg)](https://travis-ci.org/y0lk/oauth1-etsy)
[![License](https://img.shields.io/packagist/l/y0lk/oauth1-etsy.svg)](https://github.com/y0lk/oauth1-etsy/blob/master/LICENSE)
[![Total Downloads](https://img.shields.io/packagist/dt/y0lk/oauth1-etsy.svg?maxAge=2592000)](https://packagist.org/packages/y0lk/oauth1-etsy)

This package provides Etsy API OAuth 1.0 support for the PHP League's [OAuth 1.0 Client](https://github.com/thephpleague/oauth1-client).

## Installation
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"etsy"
],
"require": {
"php": ">=5.3.0",
"php": ">=5.4.0",
"league/oauth1-client": "^1.6"
},
"require-dev": {
Expand Down
9 changes: 4 additions & 5 deletions src/Etsy.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,21 @@ public function urlTokenCredentials()
*/
public function urlUserDetails()
{
return self::API_URL.'users';
return self::API_URL.'users/__SELF__';
}

/**
* {@inheritDoc}
*/
public function userDetails($data, TokenCredentials $tokenCredentials)
{
$data = $data['user'];
$data = $data['results'][0];

$user = new User();
$user->uid = $data['user_id'];
$user->nickname = $data['login_name'];
$user->email = $data['primary_email'];

$used = array('user_id', 'login_name', 'primary_email');
$used = array('user_id', 'login_name');

// Save all extra data
$user->extra = array_diff_key($data, array_flip($used));
Expand All @@ -118,7 +117,7 @@ public function userUid($data, TokenCredentials $tokenCredentials)
*/
public function userEmail($data, TokenCredentials $tokenCredentials)
{
return $data['user']['primary_email'];
return;
}

/**
Expand Down

0 comments on commit 5e3b9c9

Please sign in to comment.