unsplash 2.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -4
- data/lib/unsplash/connection.rb +3 -2
- data/lib/unsplash/photo.rb +8 -4
- data/lib/unsplash/version.rb +1 -1
- data/unsplash.gemspec +7 -6
- metadata +35 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8761235452718ff837fb8b5300c01cbbcbb0773f0ce6a35d71a2a78f4db49a1
|
4
|
+
data.tar.gz: f53460d0b82916d1310ead53f989d1dcbd457caee4e846a7c27377abc55bb256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: facc37b4ff1c8773d8e52a3fcbcbfb8a2900ad7bd5f23a29af0b66a91b604b2b7423e75a1bff190c7aabfe7e40c6e29ac60e3ad01ca0adb5f7c678c25496c577
|
7
|
+
data.tar.gz: a711ae14751a9d360760974b1fac6a116a4a20170fe66526a10c3fd31bf21f927904e89a432914df51ef33e69195f79ec6b8efc8e671d7166cc23c4b98b04ca7
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.2
|
data/.travis.yml
CHANGED
data/lib/unsplash/connection.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'faraday/multipart'
|
2
|
+
|
1
3
|
module Unsplash #:nodoc:
|
2
4
|
|
3
5
|
# HTTP connection to and communication with the Unsplash API.
|
@@ -23,7 +25,6 @@ module Unsplash #:nodoc:
|
|
23
25
|
@api_version = version
|
24
26
|
@api_base_uri = api_base_uri
|
25
27
|
|
26
|
-
oauth_base_uri = oauth_base_uri
|
27
28
|
@oauth = ::OAuth2::Client.new(@application_access_key, @application_secret, site: oauth_base_uri) do |http|
|
28
29
|
http.request :multipart
|
29
30
|
http.request :url_encoded
|
@@ -129,7 +130,7 @@ module Unsplash #:nodoc:
|
|
129
130
|
self.class.public_send verb, path, query: params, headers: public_auth_header
|
130
131
|
end
|
131
132
|
rescue OAuth2::Error => e
|
132
|
-
OpenStruct.new(headers: {}, status: 403, body: e.
|
133
|
+
OpenStruct.new(headers: {}, status: 403, body: e.message)
|
133
134
|
end
|
134
135
|
|
135
136
|
if response.headers["Warning"]
|
data/lib/unsplash/photo.rb
CHANGED
@@ -52,9 +52,10 @@ module Unsplash # :nodoc:
|
|
52
52
|
# @param user [String] Limit selection to given User's ID.
|
53
53
|
# @param query [String] Limit selection to given search query.
|
54
54
|
# @param orientation [String] Filter by orientation of the photo. Valid values are landscape, portrait, and squarish.
|
55
|
+
# @param content_filter [String] Limit results by content_filter to avoid content that may be unsuitable for younger audiences. Valid values are low, high. Defaults to low.
|
55
56
|
# @return [Unsplash::Photo] An Unsplash Photo if count parameter is omitted
|
56
57
|
# @return [Array] An array of Unsplash Photos if the count parameter is specified. An array is returned even if count is 1
|
57
|
-
def random(count: nil, collections: nil, featured: nil, user: nil, query: nil, orientation: nil)
|
58
|
+
def random(count: nil, collections: nil, featured: nil, user: nil, query: nil, orientation: nil, content_filter: "low")
|
58
59
|
Unsplash.configuration.logger.warn "You cannot combine 'collections' and 'query' parameters. 'query' will be ignored." if collections && query
|
59
60
|
|
60
61
|
params = {
|
@@ -62,7 +63,8 @@ module Unsplash # :nodoc:
|
|
62
63
|
featured: featured,
|
63
64
|
username: user,
|
64
65
|
query: query,
|
65
|
-
orientation: orientation
|
66
|
+
orientation: orientation,
|
67
|
+
content_filter: content_filter
|
66
68
|
}.select { |k,v| v }
|
67
69
|
if count
|
68
70
|
params[:count] = count
|
@@ -83,13 +85,15 @@ module Unsplash # :nodoc:
|
|
83
85
|
# @param page [Integer] Which page of search results to return.
|
84
86
|
# @param per_page [Integer] The number of users search result per page. (default: 10, maximum: 30)
|
85
87
|
# @param orientation [String] Filter by orientation of the photo. Valid values are landscape, portrait, and squarish.
|
88
|
+
# @param content_filter [String] Limit results by content_filter to avoid content that may be unsuitable for younger audiences. Valid values are low, high. Defaults to low.
|
86
89
|
# @return [SearchResult] a list of +Unsplash::Photo+ objects.
|
87
|
-
def search(query, page = 1, per_page = 10, orientation = nil)
|
90
|
+
def search(query, page = 1, per_page = 10, orientation = nil, content_filter = "low")
|
88
91
|
params = {
|
89
92
|
query: query,
|
90
93
|
page: page,
|
91
94
|
per_page: per_page,
|
92
|
-
orientation: orientation
|
95
|
+
orientation: orientation,
|
96
|
+
content_filter: content_filter
|
93
97
|
}.select { |_k, v| v }
|
94
98
|
Unsplash::Search.search("/search/photos", self, params)
|
95
99
|
end
|
data/lib/unsplash/version.rb
CHANGED
data/unsplash.gemspec
CHANGED
@@ -18,17 +18,18 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = ">= 2.
|
21
|
+
spec.required_ruby_version = ">= 2.7.0"
|
22
22
|
|
23
|
-
spec.add_dependency "httparty", "~> 0.
|
24
|
-
spec.add_dependency "oauth2", "
|
23
|
+
spec.add_dependency "httparty", "~> 0.20"
|
24
|
+
spec.add_dependency "oauth2", ">= 2.0.8"
|
25
|
+
spec.add_dependency "faraday-multipart", "~> 1.0.4"
|
25
26
|
|
26
27
|
spec.add_development_dependency "rake", "~> 12.3.2"
|
27
28
|
spec.add_development_dependency "rspec", "~> 3.8.0"
|
28
|
-
spec.add_development_dependency "vcr", "~>
|
29
|
-
spec.add_development_dependency "webmock", "~> 3.
|
29
|
+
spec.add_development_dependency "vcr", "~> 6.1.0"
|
30
|
+
spec.add_development_dependency "webmock", "~> 3.18.1"
|
30
31
|
spec.add_development_dependency "pry"
|
31
|
-
spec.add_development_dependency "
|
32
|
+
spec.add_development_dependency "coveralls_reborn", "~> 0.25.0"
|
32
33
|
spec.add_development_dependency "dotenv"
|
33
34
|
spec.add_development_dependency "rb-readline"
|
34
35
|
end
|
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:
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Klaassen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.20'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.20'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.8
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.8
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday-multipart
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: 1.0.4
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 1.0.4
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +86,28 @@ dependencies:
|
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 6.1.0
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 6.1.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: webmock
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
103
|
+
version: 3.18.1
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.
|
110
|
+
version: 3.18.1
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: pry
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,19 +123,19 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: coveralls_reborn
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - "
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 0.25.0
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 0.25.0
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: dotenv
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +164,7 @@ dependencies:
|
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
153
|
-
description:
|
167
|
+
description:
|
154
168
|
email:
|
155
169
|
- aaron@unsplash.com
|
156
170
|
executables: []
|
@@ -189,7 +203,7 @@ homepage: https://github.com/unsplash/unsplash_rb
|
|
189
203
|
licenses:
|
190
204
|
- MIT
|
191
205
|
metadata: {}
|
192
|
-
post_install_message:
|
206
|
+
post_install_message:
|
193
207
|
rdoc_options: []
|
194
208
|
require_paths:
|
195
209
|
- lib
|
@@ -197,15 +211,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
197
211
|
requirements:
|
198
212
|
- - ">="
|
199
213
|
- !ruby/object:Gem::Version
|
200
|
-
version: 2.
|
214
|
+
version: 2.7.0
|
201
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
216
|
requirements:
|
203
217
|
- - ">="
|
204
218
|
- !ruby/object:Gem::Version
|
205
219
|
version: '0'
|
206
220
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
208
|
-
signing_key:
|
221
|
+
rubygems_version: 3.3.7
|
222
|
+
signing_key:
|
209
223
|
specification_version: 4
|
210
224
|
summary: Ruby wrapper for the Unsplash API.
|
211
225
|
test_files: []
|