lib/unsplash/collection.rb in unsplash-1.5.0 vs lib/unsplash/collection.rb in unsplash-1.5.1
- old
+ new
@@ -1,6 +1,6 @@
-module Unsplash # :nodoc:
+module Unsplash # :nodoc:
# Unsplash Collection operations.
class Collection < Client
class << self
@@ -28,11 +28,11 @@
# Get a list of all featured collections.
# @param page [Integer] Which page of results to return.
# @param per_page [Integer] The number of results per page. (default: 10, maximum: 30)
- # @return [Array] A single page of the +Unsplash::Collection+ list.
+ # @return [Array] A single page of the +Unsplash::Collection+ list.
def featured(page = 1, per_page = 10)
params = {
page: page,
per_page: per_page
}
@@ -56,11 +56,11 @@
# Create a new collection on behalf of current user.
# @param title [String] The title of the collection.
# @param description [String] The collection's description. (optional)
# @param private [Boolean] Whether to make the collection private. (optional, default +false+)
def create(title: "", description: "", private: false)
- params = {
+ params = {
title: title,
description: description,
private: private
}
Unsplash::Collection.new JSON.parse(connection.post("/collections", params).body)
@@ -68,11 +68,11 @@
# Get a single page of collection results for a query.
# @param query [String] Keywords to search for.
# @param page [Integer] Which page of search results to return.
# @param per_page [Integer] The number of collections search result per page. (default: 10, maximum: 30)
- # @return [Array] a list of +Unsplash::Collection+ objects.
+ # @return [SearchResult] a list of +Unsplash::Collection+ objects.
def search(query, page = 1, per_page = 10)
params = {
query: query,
page: page,
per_page: per_page
@@ -91,10 +91,10 @@
# Update the collection's attributes.
# @param title [String] The title of the collection.
# @param description [String] The collection's description. (optional)
# @param private [Boolean] Whether to make the collection private. (optional)
def update(title: nil, description: nil, private: nil)
- params = {
+ params = {
title: title,
description: description,
private: private
}.select { |k,v| v }
updated = JSON.parse(connection.put("/collections/#{id}", params).body)