This repository was archived by the owner on Oct 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Reportback items endpoint #5055
Merged
chloealee
merged 10 commits into
DoSomethingArchive:dev
from
chloealee:reportback-items-endpoint
Sep 10, 2015
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0a07294
GET call to ns for user data
chloealee c76304d
returns correct information in api endpoint with manually added id
chloealee 3be9fed
adds cache
chloealee 5a2beb6
add cache_set
chloealee a33aaa9
comment out hard coded
chloealee 4206867
updates with edits from Andrea
chloealee 79b8519
fix cache, json_decode, and local url
chloealee bc66055
cleans up code and cache is working
chloealee 74c1967
uncomments out local line
chloealee 7848854
removes comments in dosomething_northstar.install
chloealee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?php | ||
| /** | ||
| * @file | ||
| * Installation and schema hooks for dosomething_northstar.module. | ||
| */ | ||
|
|
||
| /** | ||
| * Implements hook_schema(). | ||
| */ | ||
| function dosomething_northstar_user_info_schema() { | ||
| $schema['cache_northstar_user_info'] = drupal_get_schema_unprocessed('dosomething_northstar', 'cache_northstar_user_info'); | ||
| return $schema; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,8 +115,17 @@ private function build($data) { | |
| 'verb' => $data->verb, | ||
| ], | ||
| ]; | ||
|
|
||
| $northstar_user = dosomething_northstar_get_northstar_user($data->uid); | ||
| $northstar_user = json_decode($northstar_user->data, true); | ||
| $northstar_user = (object) $northstar_user['data'][0]; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not vital at all (or maybe just a future update to consider), but might be cleaner if you could save the nested array to $northstar_user = json_decode($northstar_user->data, true);
$northstar_user = (object) $northstar_user['data'][0];So then you can get each item similar to how code above retrieves it for consistency: $this->user = [
'id' => $data->uid,
'first_name' => $northstar_user->first_name,
'last_name' => $northstar_user->last_name,
'photo' => $northstar_user->photo,
'country' => $northstar_user->country,
];Something like that... :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that looks a lot better, I'll update now, thanks Diego! |
||
| $this->user = [ | ||
| 'id' => $data->uid, | ||
| 'first_name' => $northstar_user->first_name, | ||
| 'last_name' => $northstar_user->last_name, | ||
| 'photo' => $northstar_user->photo, | ||
| 'country' => $northstar_user->country, | ||
| ]; | ||
| } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you
json_decodethe whole thing here, so you don't have to do it for each thing below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated!