yummly 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +45 -3
- data/lib/yummly.rb +9 -0
- data/lib/yummly/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Yummly
|
2
2
|
|
3
|
-
|
3
|
+
This is the unofficial ruby wrapper to the Yummly API, "the world's largest and most powerful recipe search site".
|
4
|
+
|
5
|
+
https://developer.yummly.com/
|
6
|
+
|
7
|
+
Still in the baking phase. Tests are being written, lots of churn at the moment.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -16,9 +20,47 @@ Or install it yourself as:
|
|
16
20
|
|
17
21
|
$ gem install yummly
|
18
22
|
|
19
|
-
##
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
First, configure Yummly with your APP key and ID, for example in an initializer if you're using Rails:
|
26
|
+
|
27
|
+
Yummly.configure do |config|
|
28
|
+
config.app_id = "21334"
|
29
|
+
config.app_key = "XXXXXXXXXXXXXXXXX"
|
30
|
+
config.use_ssl = true # Default is false
|
31
|
+
end
|
32
|
+
|
33
|
+
_Note: HTTPS API access is only available on some paid Yummly plans._
|
34
|
+
|
35
|
+
## API calls
|
36
|
+
|
37
|
+
Once configured, you have access to two API calls:
|
38
|
+
|
39
|
+
#### Search
|
40
|
+
|
41
|
+
The search command returns an array of Yummly::Recipe objects:
|
42
|
+
|
43
|
+
Yummly::Api.search('Onion soup')
|
44
|
+
|
45
|
+
#### Find
|
46
|
+
|
47
|
+
The find command returns a single Yummly::Recipe object:
|
48
|
+
|
49
|
+
Yummly::Api.find('French-Onion-Soup-The-Pioneer-Woman-Cooks-_-Ree-Drummond-41364')
|
50
|
+
|
51
|
+
## The Recipe object
|
52
|
+
|
53
|
+
The Yummly ruby wrapper returns all results as recipe objects. These objects normalize the API responses to make it
|
54
|
+
easier for developers to interact with recipes from ruby. All Yummly recipe attributes have been directly mapped, and
|
55
|
+
in cases where the JSON response returned an array for a specific attribute and array of related objects are returned
|
56
|
+
from the ruby Recipe object.
|
57
|
+
|
58
|
+
For example, to access the thumbnail image for a recipe:
|
59
|
+
|
60
|
+
recipe = Yummly::Api.find('French-Onion-Soup-The-Pioneer-Woman-Cooks-_-Ree-Drummond-41364')
|
61
|
+
recipe.images.first.small_url
|
20
62
|
|
21
|
-
|
63
|
+
Explore the Yummly::Recipe class to see the full range of available attributes.
|
22
64
|
|
23
65
|
## Contributing
|
24
66
|
|
data/lib/yummly.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "yummly/api"
|
2
|
+
require "yummly/connection"
|
2
3
|
require "yummly/configuration"
|
3
4
|
require "yummly/flavor"
|
4
5
|
require "yummly/image"
|
@@ -21,5 +22,13 @@ module Yummly
|
|
21
22
|
yield(configuration)
|
22
23
|
self.configuration = configuration
|
23
24
|
end
|
25
|
+
|
26
|
+
def search(terms, params = {})
|
27
|
+
Yummly::Api.search(terms, params)
|
28
|
+
end
|
29
|
+
|
30
|
+
def find(recipe_id)
|
31
|
+
Yummly::Api.find(recipe_id)
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
data/lib/yummly/version.rb
CHANGED