unsplash 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/unsplash/photo.rb +25 -1
- data/lib/unsplash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 225c7f132cc0a217b99815db374ffc07623930cb
|
4
|
+
data.tar.gz: bf58f236014eff003ba68afc41889856d7dbc866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd2faeada759be7f8413f5e27c6b6b6c69790b675de3f59846bce26d291cbb2514e3cf58104850564f4bbb1da32f05267309a0d19110e2d14cead608b27620f
|
7
|
+
data.tar.gz: 91ebafb974c916f86f96dbc4e105c4e06bb713dc62176b28f865433cb4f46a11452ee3f38462d0f1158d79d8b72fda72098341231779650bb952d5a666636fdb
|
data/lib/unsplash/photo.rb
CHANGED
@@ -16,12 +16,36 @@ module Unsplash # :nodoc:
|
|
16
16
|
w: width,
|
17
17
|
h: height,
|
18
18
|
rect: crop_rect
|
19
|
-
}.
|
19
|
+
}.select { |k,v| v }
|
20
20
|
photo = Unsplash::Photo.new JSON.parse(connection.get("/photos/#{id}", custom).body)
|
21
21
|
photo.user = Unsplash::User.new photo.user
|
22
22
|
photo
|
23
23
|
end
|
24
24
|
|
25
|
+
# Get a random photo. The photo selection pool can be narrowed using
|
26
|
+
# a combination of optional parameters. Can also optionally specify a custom image size.
|
27
|
+
# @param categories [Array] Limit selection to given category ID's.
|
28
|
+
# @param featured [Boolean] Limit selection to featured photos.
|
29
|
+
# @param user [String] Limit selection to given User's ID.
|
30
|
+
# @param query [String] Limit selection to given search query.
|
31
|
+
# @param width [Integer] Width of customized version of the photo.
|
32
|
+
# @param height [Integer] Height of the customized version of the photo.
|
33
|
+
# @return [Unsplash::Photo] An Unsplash Photo.
|
34
|
+
def random(categories: nil, featured: nil, user: nil, query: nil, width: nil, height: nil)
|
35
|
+
params = {
|
36
|
+
category: (categories && categories.join(",")),
|
37
|
+
featured: featured,
|
38
|
+
username: user,
|
39
|
+
query: query,
|
40
|
+
w: width,
|
41
|
+
h: height
|
42
|
+
}.select { |k,v| v }
|
43
|
+
|
44
|
+
photo = Unsplash::Photo.new JSON.parse(connection.get("/photos/random", params).body)
|
45
|
+
photo.user = Unsplash::User.new photo.user
|
46
|
+
photo
|
47
|
+
end
|
48
|
+
|
25
49
|
# Search for photos by keyword.
|
26
50
|
# @param query [String] Keywords to search for.
|
27
51
|
# @param page [Integer] Which page of search results to return.
|
data/lib/unsplash/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unsplash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Klaassen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|