unsplash 1.5.1 → 1.5.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.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/unsplash/collection.rb +2 -2
- data/lib/unsplash/photo.rb +6 -0
- 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: b0f81e610661ea5f391d577a27c0eb07260ec937
|
4
|
+
data.tar.gz: 6e143ef14b52e58339226b947d07e2ece908b3c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4439758d404d17113aaac63b28c5c084bb8b4cf5b9ccb670f236089f9d810c1103fef0e32b5469815472727313f310298e197730357e4ea48c4b8e61bb7094
|
7
|
+
data.tar.gz: fcba0381f752839058dca31f1b5876e2957a2bf8db1787b3938cb8605cf9aa3f63f80225aebc91222494103f569ad9b32ab7ba426407b723cce458ee479a5b00
|
data/README.md
CHANGED
@@ -37,9 +37,11 @@ Unsplash.configure do |config|
|
|
37
37
|
end
|
38
38
|
```
|
39
39
|
|
40
|
-
####
|
40
|
+
#### API Guidelines
|
41
41
|
|
42
|
-
|
42
|
+
All API applications must abide by the [API Guidelines](https://medium.com/unsplash/unsplash-api-guidelines-28e0216e6daa).
|
43
|
+
|
44
|
+
As part of [the API guidelines](https://medium.com/unsplash/unsplash-api-guidelines-28e0216e6daa), all API uses are required to use utm links when providing credit to photographers and Unsplash. Set the `config.utm_source` to your app's name to automatically append the utm source.
|
43
45
|
|
44
46
|
### Public-scope actions
|
45
47
|
|
@@ -81,9 +83,9 @@ permission scopes you requested and the user authorized.
|
|
81
83
|
|
82
84
|
### Hotlinking
|
83
85
|
|
84
|
-
Hotlinking the Unsplash image files is
|
86
|
+
Hotlinking the [Unsplash image files is required](https://medium.com/@lukechesser/unsplash-api-guidelines-hotlinking-images-6c6b51030d2a)
|
85
87
|
|
86
|
-
Unlike most APIs, Unsplash
|
88
|
+
Unlike most APIs, Unsplash requires for the image URLs returned by the API to be directly used or embedded in your applications (generally referred to as hotlinking). By using the CDN and embedding the photo URLs in your application, Unsplash can better track photo views and pass those stats on to the photographer, providing them with context for how popular their photo is and how it's being used.
|
87
89
|
|
88
90
|
## Development
|
89
91
|
|
data/lib/unsplash/collection.rb
CHANGED
@@ -108,7 +108,7 @@ module Unsplash # :nodoc:
|
|
108
108
|
# @return [Boolean] +true+ on success.
|
109
109
|
def destroy
|
110
110
|
response = connection.delete("/collections/#{id}")
|
111
|
-
response.status
|
111
|
+
(200..299).include?(response.status)
|
112
112
|
end
|
113
113
|
|
114
114
|
# Get a list of the photos contained in this collection.
|
@@ -145,7 +145,7 @@ module Unsplash # :nodoc:
|
|
145
145
|
# @return [Boolean] +true+ on success.
|
146
146
|
def remove(photo)
|
147
147
|
response = connection.delete("/collections/#{id}/remove", photo_id: photo.id)
|
148
|
-
response.status
|
148
|
+
(200..299).include?(response.status)
|
149
149
|
end
|
150
150
|
|
151
151
|
end
|
data/lib/unsplash/photo.rb
CHANGED
@@ -17,6 +17,12 @@ module Unsplash # :nodoc:
|
|
17
17
|
true
|
18
18
|
end
|
19
19
|
|
20
|
+
# Download a photo.
|
21
|
+
# @return [String] URL of image file for download.
|
22
|
+
def download!
|
23
|
+
connection.get(links.download_location)["url"]
|
24
|
+
end
|
25
|
+
|
20
26
|
class << self
|
21
27
|
|
22
28
|
# Get a photo. Can be cropped or resized using the optional parameters.
|
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.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Klaassen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|