fotofetch 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f3715843ca845f769945605b02c5f5ba8650c0e
4
- data.tar.gz: 7373b2647359950dc6f7fd586b9a152a0bb2da52
3
+ metadata.gz: 46802facb22655cc2d53909538474e27cbcba3f0
4
+ data.tar.gz: 1a23a7e8b2bbccd6b9d7f896c551411d08d74f17
5
5
  SHA512:
6
- metadata.gz: 28c768acd157cd69d9243cb5d3d203e5d40d0647146cb48f2653966073efefd720b7a473e5826d044f1877f0e972aa8890dd90238885549826fce0d37b43a22d
7
- data.tar.gz: 0704ab36cd6ca3614d6e44772e3205177c5bb066d53545c666a73a2139ea45a013c5cb08ec0fccd3c073b2f6da73320a3de3b1a08bd961f0a4e3d7c5e15e1f02
6
+ metadata.gz: 3c825f85257c44408be9d9d6c5256e034f2edef6f87623364f67ec2e97c9253d99d2ad1afd5dde7f889960adaccc3177b89da443882fc4891458817f33cde903
7
+ data.tar.gz: f657ff62922cd82a7f0d9aab304dc9a4fe3a71bb836ee942a8f6cd0d6ca39cac8f47469eb4ace1b262039dcaa68f967d9b05a04d4347d7a8b731a11e9b72344e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fotofetch (1.1.1)
4
+ fotofetch (1.1.2)
5
5
  fastimage (~> 2.0.0)
6
6
  mechanize
7
7
 
data/README.md CHANGED
@@ -28,9 +28,9 @@ Or install it yourself as:
28
28
  ```ruby
29
29
  link = @fetcher.fetch_links("tesla model s")
30
30
  ```
31
- - To save the link to your file directory
31
+ - To save the link to your file directory (links must be in an array, so call .values):
32
32
  ```ruby
33
- @ff.save_images(link, './')
33
+ @ff.save_images(link.values, './')
34
34
  ```
35
35
  The 'save_images' method takes two arguments: link(s) and the file path for where to save.
36
36
 
@@ -50,7 +50,7 @@ links = @fetcher.fetch_links("jupiter", 3, 1500, 1500)
50
50
  ```
51
51
  And to save all of those links:
52
52
  ```ruby
53
- @fetcher.save_images(links, './')
53
+ @fetcher.save_images(links.values, './')
54
54
  ```
55
55
  If a small or large enough image is not found, dimension restrictions will be disregarded.
56
56
 
@@ -5,8 +5,8 @@ require 'fastimage'
5
5
 
6
6
  module Fotofetch
7
7
  class Fetch
8
-
9
8
  def fetch_links(topic, amount=1, width= +9999, height= +9999)
9
+ @query = topic
10
10
  @results = []
11
11
  scrape(topic, amount, width, height)
12
12
  end
@@ -69,7 +69,7 @@ module Fotofetch
69
69
  # takes an array of links
70
70
  def save_images(urls, file_path)
71
71
  urls.each_with_index do |url, i|
72
- open("image_#{i}.jpg", 'wb') do |file|
72
+ open("#{@query.gsub(' ', '-')}_#{i}.jpg", 'wb') do |file|
73
73
  file << open(url).read
74
74
  end
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module Fotofetch
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
Binary file
@@ -29,9 +29,9 @@ class FotofetchTest < Minitest::Test
29
29
  link = @ff.fetch_links("tesla", 1).values
30
30
  @ff.save_images(link, './')
31
31
 
32
- assert File.exist?('image_0.jpg')
33
- refute File.zero?('image_0.jpg')
34
- File.delete('image_0.jpg')
32
+ assert File.exist?('tesla_0.jpg')
33
+ refute File.zero?('tesla_0.jpg')
34
+ File.delete('tesla_0.jpg')
35
35
  end
36
36
 
37
37
  def test_it_checks_image_size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fotofetch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Olson