https://github.com/imryan/datakick-ios
💾 Objective-C library for the Datakick service (DEPRECATED)
https://github.com/imryan/datakick-ios
datakick-service gtin
Last synced: about 1 month ago
JSON representation
💾 Objective-C library for the Datakick service (DEPRECATED)
- Host: GitHub
- URL: https://github.com/imryan/datakick-ios
- Owner: imryan
- Created: 2016-03-25T17:09:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-07-03T02:30:14.000Z (almost 9 years ago)
- Last Synced: 2025-01-20T10:45:38.535Z (over 1 year ago)
- Topics: datakick-service, gtin
- Language: Objective-C
- Homepage: https://www.datakick.org
- Size: 164 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
datakick-ios
--
An iOS library/wrapper for the Datakick service.
Usage
--
Usage is simple. All values are returned through completion blocks.
Each `Item` object holds a few basic attributes:
* `gtin14`
* `brandName`
* `name`
* `size`
* `images` an NSArray that contains URL strings to images.
##### Retrieving the first 100 objects
```
[[Datakick sharedInstance] getAllItemsWithBlock:^(NSArray *items) {
for (Item *item in items) {
NSLog(@"%@", item.name);
}
}];
```
##### Retrieving an Item object by its GTIN-14 identifier
```
[[Datakick sharedInstance] getItemByGtin:@"000000000000" withBlock:^(Item *item) {
NSLog(@"Item: %@", item.name);
}];
```
##### Retrieving an Item object from a query
```
[[Datakick sharedInstance] getItemsByQuery:@"cookies" withBlock:^(NSArray *items) {
for (Item *item in items) {
NSLog(@"%@", item.name);
}
}];
```
##### Updating an Item object
Just pass it an `NSDictionary` and fill it with any of these optional parameters:
* brand_name
* name
* size
* ingredients
* serving_size
* servings_per_container
* calories
* fat_calories
* fat
* saturated_fat
* trans_fat
* polyunsaturated_fat
* monounsaturated_fat
* cholesterol
* sodium
* potassium
* carbohydrate
* fiber
* sugars
* protein
* author
* format
* publisher
* pages
* alcohol_by_volume
```
NSDictionary *attributes = @{
@"brand_name" : @"The Best Brand Co.",
@"name" : @"Demo",
@"size" : @"40 oz."
};
[[Datakick sharedInstance] updateItemWithGtin:@"000000000000" attributes:attributes block:^(NSError *error) {
if (error) NSLog(@"Error: %@", error);
}];