unsplash 1.5.5 → 1.5.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a76489273274f70d03a341e273346ea69b8d949c
4
- data.tar.gz: 42012aefb32a0511320b86501191a121cd563d67
2
+ SHA256:
3
+ metadata.gz: 2baf82aec25861dec27432935378a12e49344a1920e8c6d2a0f3972cf80ae275
4
+ data.tar.gz: 6964813d9ed8b4bf69122900ed31c6e498cac94ab2748f33f7277086772ea42d
5
5
  SHA512:
6
- metadata.gz: 07b2fb678ae333dd9f5ac29c8e33944a8133da8155baf0e589e9c07a6ba3b6670456cdc8ed8d8c5c7e9f50449bb1cdc1bee1702d1c210722c7b6742a6c01cb86
7
- data.tar.gz: 9e24ae36807e5de855c21c8219c0d9ef3ea76ffe875fa4312f66b1b4401d67986b81a728a671019d76e62f25d2782de2365cb646068bca98366fff0717c4c296
6
+ metadata.gz: 241302c561d0633f1403c483e3fb787dfe1a13319bdf868dc65fe55c17ab9d170adb4d28473a29b1e4ef6ed71ac5d6098a5cde69249d65c9f4ef3546ba3a2b32
7
+ data.tar.gz: eaa1640eccffbe19204a2c5a959d3a67533819f6879a35e0bda1bb7469e07396eec791abd4ddb2ca05981849935adfe881e209ef4882aa4e7d14bedc33f2d83c
@@ -7,17 +7,17 @@ module Unsplash # :nodoc:
7
7
 
8
8
  # Get a list of all of the Unsplash photo categories.
9
9
  # @return [Array] The list categories.
10
+ # <b>DEPRECATED</b>
10
11
  def all
11
- JSON.parse(connection.get("/categories/").body).map do |category|
12
- new category
13
- end
12
+ raise Unsplash::DeprecationError.new "Category has been deprecated and removed."
14
13
  end
15
14
 
16
15
  # Get an Unsplash Category.
17
16
  # @param id [Integer] The ID of the category to retrieve.
18
17
  # @return [Unsplash::Category] The specified category.
18
+ # <b>DEPRECATED</b>
19
19
  def find(id)
20
- new JSON.parse(connection.get("/categories/#{id}").body)
20
+ raise Unsplash::DeprecationError.new "Category has been deprecated and removed."
21
21
  end
22
22
  end
23
23
 
@@ -25,13 +25,9 @@ module Unsplash # :nodoc:
25
25
  # @param page [Integer] Which page of search results to return.
26
26
  # @param per_page [Integer] The number of search results per page.
27
27
  # @return [Array] A single page of +Unsplash::Photo+s.
28
+ # <b>DEPRECATED</b>
28
29
  def photos(page = 1, per_page = 10)
29
- params = {
30
- page: page,
31
- per_page: per_page
32
- }
33
- list = JSON.parse(connection.get("/categories/#{id}/photos", params).body)
34
- list.map { |photo| Unsplash::Photo.new photo }
30
+ raise Unsplash::DeprecationError.new "Category has been deprecated and removed."
35
31
  end
36
32
  end
37
- end
33
+ end
@@ -26,4 +26,4 @@ module Unsplash # :nodoc:
26
26
  end
27
27
 
28
28
  end
29
- end
29
+ end
@@ -127,10 +127,14 @@ module Unsplash #:nodoc:
127
127
 
128
128
  status_code = response.respond_to?(:status) ? response.status : response.code
129
129
 
130
- if !(200..299).include?(status_code)
131
- body = JSON.parse(response.body)
132
- msg = body["error"] || body["errors"].join(" ")
133
- raise Unsplash::Error.new msg
130
+ begin
131
+ if !(200..299).include?(status_code)
132
+ body = JSON.parse(response.body)
133
+ msg = body["error"] || body["errors"].join(" ")
134
+ raise Unsplash::Error.new msg
135
+ end
136
+ rescue JSON::ParserError
137
+ raise Unsplash::Error.new response.body
134
138
  end
135
139
 
136
140
  response
@@ -40,4 +40,4 @@ module Unsplash # :nodoc:
40
40
  end
41
41
 
42
42
  end
43
- end
43
+ end
@@ -1,4 +1,6 @@
1
1
  module Unsplash # :nodoc:
2
2
  # Raised when there is an error communicating with Unsplash.
3
3
  class Error < StandardError; end
4
- end
4
+ # Raise for deprecation errors
5
+ class DeprecationError < Error; end
6
+ end
@@ -128,7 +128,7 @@ module Unsplash # :nodoc:
128
128
  # @return [Unsplash::Photo] The uploaded photo.
129
129
  # <b>DEPRECATED</b>
130
130
  def create(filepath)
131
- raise Unsplash::Error.new "API photo-upload endpoint has been deprecated and removed."
131
+ raise Unsplash::DeprecationError.new "API photo-upload endpoint has been deprecated and removed."
132
132
  end
133
133
 
134
134
  private
@@ -12,4 +12,4 @@ module Unsplash # :nodoc:
12
12
  end
13
13
  end
14
14
 
15
- end
15
+ end
@@ -1,4 +1,4 @@
1
1
  module Unsplash # :nodoc:
2
2
  # :nodoc:
3
- VERSION = "1.5.5"
3
+ VERSION = "1.5.6"
4
4
  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: 1.5.5
4
+ version: 1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Klaassen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -177,8 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubyforge_project:
181
- rubygems_version: 2.6.10
180
+ rubygems_version: 3.0.3
182
181
  signing_key:
183
182
  specification_version: 4
184
183
  summary: Ruby wrapper for the Unsplash API.