Skip to content

Commit

Permalink
Remove Photo#create and Photo#curated (they use deprecated/removed AP…
Browse files Browse the repository at this point in the history
…I endpoints).
  • Loading branch information
aaronklaassen committed Mar 19, 2019
1 parent 360c6ca commit 2b6f72e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
22 changes: 0 additions & 22 deletions lib/unsplash/photo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,28 +107,6 @@ def all(page = 1, per_page = 10, order_by = "latest")
parse_list connection.get("/photos/", params).body
end

# Get a single page from the list of the curated photos (front-page’s photos).
# @param page [Integer] Which page of search results to return.
# @param per_page [Integer] The number of search results per page. (default: 10, maximum: 30)
# @param order_by [String] How to sort the photos. (Valid values: latest, oldest, popular; default: latest)
# @return [Array] A single page of +Unsplash::Photo+ search results.
def curated(page = 1, per_page = 10, order_by = "latest")
params = {
page: page,
per_page: per_page,
order_by: order_by
}
parse_list connection.get("/photos/curated", params).body
end

# Upload a photo on behalf of the current user.
# @param filepath [String] The local path of the image file to upload.
# @return [Unsplash::Photo] The uploaded photo.
# <b>DEPRECATED</b>
def create(filepath)
raise Unsplash::DeprecationError.new "API photo-upload endpoint has been deprecated and removed."
end

private

def parse_list(json)
Expand Down
25 changes: 0 additions & 25 deletions spec/lib/photo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,6 @@
end
end

describe "#curated" do
it "returns an array of Photos" do
VCR.use_cassette("photos") do
@photos = Unsplash::Photo.curated(1, 6)
end

expect(@photos).to be_an Array
expect(@photos.size).to eq 6
end
end

describe "#create" do

it "errors on trying to upload a photo" do
stub_oauth_authorization

expect {
VCR.use_cassette("photos", match_requests_on: [:method, :path, :body]) do
@photo = Unsplash::Photo.create "spec/support/upload-1.txt"
end
}.to raise_error Unsplash::DeprecationError
end

end

describe "#like!" do
let(:photo_id) { "tAKXap853rY" }

Expand Down

0 comments on commit 2b6f72e

Please sign in to comment.