image_suckr 0.0.3 → 0.0.4

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 CHANGED
@@ -1,27 +1,49 @@
1
1
  Description
2
- -----------
2
+ ---
3
3
  ImageSuckr is a ruby gem that allows you to get random images from Google for seeding purposes.
4
+
4
5
  In a future it will support other sources.
5
6
 
6
7
  Installation
7
- ------------
8
+ ---
8
9
  1. Add `gem 'image_suckr'` to your Gemfile
9
10
  2. Run `bundle install`
10
11
 
11
12
  Basic use
12
- ---------
13
+ ---
14
+ **Create an ImageSuckr object:**
15
+
13
16
  suckr = ImageSuckr::GoogleSuckr.new
14
17
 
15
- To get a fully random image url:
18
+ **To get a fully random image URL:**
16
19
 
17
- suckr.getImageUrl
20
+ suckr.get_image_url
18
21
 
19
- To get a random image url based on a query:
22
+ **To get a random image URL based on a query:**
20
23
 
21
- suckr.getImageUrl({"q" => "car"})
24
+ suckr.get_image_url({"q" => "car"})
22
25
 
23
26
  _All [Google Image Search API arguments](http://code.google.com/apis/imagesearch/v1/jsondevguide.html#json_args) are supported and you can use them to filter your results._
24
27
 
25
- To get the image content instead of the url:
28
+ **To get the image content instead of the URL:**
29
+
30
+ suckr.get_image
31
+
32
+ Other useful examples
33
+ ---
34
+
35
+ **To get a RMagick image:**
36
+
37
+ _You need to install [RMagick](http://rmagick.rubyforge.org/) to use this._
26
38
 
27
- suckr.getImage
39
+ image = Magick::Image.from_blob(suckr.get_image).first
40
+
41
+ **To get a MiniMagick image:**
42
+
43
+ _You need to install [MiniMagick](https://github.com/probablycorey/mini_magick) to use this._
44
+
45
+ image = MiniMagick::Image.read(suckr.get_image)
46
+
47
+ or
48
+
49
+ image = MiniMagick::Image.open(suckr.get_image_url)
@@ -1,3 +1,3 @@
1
1
  module ImageSuckr
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/image_suckr.rb CHANGED
@@ -16,7 +16,7 @@ module ImageSuckr
16
16
  "v" => "1.0"
17
17
  }
18
18
 
19
- def getImageUrl(params = {})
19
+ def get_image_url(params = {})
20
20
  params = DEFAULT_PARAMS.merge(params)
21
21
  params["q"] = rand(1000).to_s if params["q"].nil?
22
22
  url = "http://ajax.googleapis.com/ajax/services/search/images?" + params.to_query
@@ -25,7 +25,7 @@ module ImageSuckr
25
25
  imageUrl = result["responseData"]["results"][rand(params["rsz"].to_i)]["url"]
26
26
  end
27
27
 
28
- def getImage(params = {})
28
+ def get_image(params = {})
29
29
  image = Net::HTTP.get_response(URI.parse(getImageUrl(params))).body
30
30
  end
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_suckr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: