pexels 0.3.0 → 0.4.0

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
2
  SHA256:
3
- metadata.gz: fbc208fe2d27e3dca7c1b94e0e2a3901334d06b9cf3460d952a44aea437bd82e
4
- data.tar.gz: f4796400297cf53c41b0740eb57ae9b70efd697018d20c17c0e91f92c9030dc6
3
+ metadata.gz: e749787cf73bb5029e528f9d0232d2ce6c638dc81d13c12c7e91346b8962b2be
4
+ data.tar.gz: a531ae402dc483373295381e4fe613e0a169b813081a3964692b81d5af9bbaa4
5
5
  SHA512:
6
- metadata.gz: e050b1e25f4f66b370f1acd2695af58305cd221e7c7d9a67cf4f989bdc3959af172aaebc65b545507992af0a6d24594e19601f316f5b1e2145ebbbc59eae46ce
7
- data.tar.gz: 5a334832f860fcbb21dde178bdd871491d70efdeccfa5515309186596fcd1884b4ca3884bd6a6574343daa40623524ce20137366096460a015372a09365020aa
6
+ metadata.gz: ad853babd229b319f25253cf036d8fd97b7c9262de26566d36d7fec7ddd4d7a2240038b200f4fca0551e30608038c4de6cc6844594cc3c8720368d26dd49a7e6
7
+ data.tar.gz: aeda8080d6ad67c5aa1175081481337a2be0e7f1ed46619f2e5ccbee2944297b83aa7d3e4bae0df8949a04d80356a2e01f325dc539b874d6fa29e9b64f9e8906
data/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change log
2
2
 
3
+ ## 0.4.0
4
+ * Add support for returning featured collections.
5
+
3
6
  ## 0.3.0
4
7
  * Add support for photo and video search with filters.
5
8
  * Added `avg_color` attribute to `Photo` object.
data/README.md CHANGED
@@ -30,6 +30,12 @@ client = Pexels::Client.new('your-access-key')
30
30
  client.photos.search('Cloud')
31
31
  ```
32
32
 
33
+ ### Search for photos with filters
34
+
35
+ ```ruby
36
+ client.photos.search('Dog', color: :yellow, size: :large, orientation: :square)
37
+ ```
38
+
33
39
  ### Find a specific photo
34
40
 
35
41
  ```ruby
@@ -50,6 +56,12 @@ client.photos.curated
50
56
  client.videos.search('waves')
51
57
  ```
52
58
 
59
+ ### Search for videos with filters
60
+
61
+ ```ruby
62
+ client.videos.search('Beach', size: :medium, orientation: :landscape)
63
+ ```
64
+
53
65
  ### Find a specific photo
54
66
 
55
67
  ```ruby
@@ -71,6 +83,11 @@ Note: this is limited to collections belonging to the API user.
71
83
  ```ruby
72
84
  client.collections.all
73
85
  ```
86
+ ### List all featured collections.
87
+
88
+ ```ruby
89
+ client.collections.featured.all
90
+ ```
74
91
 
75
92
  ### Get all media for a collection
76
93
 
@@ -14,6 +14,17 @@ class Pexels::Client::Collections
14
14
  Pexels::CollectionSet.new(response)
15
15
  end
16
16
 
17
+ def featured(per_page: 15, page: 1)
18
+ response = @client.request(
19
+ "#{Pexels.api_version}/collections/featured",
20
+ params: {
21
+ per_page: per_page,
22
+ page: page
23
+ })
24
+
25
+ Pexels::CollectionSet.new(response)
26
+ end
27
+
17
28
  def [](id, type: nil, per_page: 15, page: 1)
18
29
  response = @client.request(
19
30
  "#{Pexels.api_version}/collections/#{id}",
@@ -1,3 +1,3 @@
1
1
  module Pexels
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -27,6 +27,25 @@ class TestCollections < Minitest::Test
27
27
  assert_kind_of Pexels::CollectionSet, collection_with_params.prev_page
28
28
  end
29
29
 
30
+ def test_featured
31
+ collection = @client.collections.featured
32
+
33
+ assert_kind_of Pexels::CollectionSet, collection
34
+ assert_equal collection.per_page, 15
35
+ assert_equal collection.page, 1
36
+
37
+ assert collection.collections.is_a? Array
38
+ assert collection.collections.any?
39
+ assert collection.first.is_a? Pexels::Collection
40
+
41
+ collection_with_params = @client.collections.featured(per_page: 1, page: 2)
42
+ assert_equal collection_with_params.per_page, 1
43
+ assert_equal collection_with_params.page, 2
44
+ assert_equal collection_with_params.collections.length, 1
45
+ assert_kind_of Pexels::CollectionSet, collection_with_params.next_page
46
+ assert_kind_of Pexels::CollectionSet, collection_with_params.prev_page
47
+ end
48
+
30
49
  def test_get_collection_media
31
50
  collection = @client.collections[@collection.id]
32
51
  assert_kind_of Pexels::CollectionMediaSet, collection
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pexels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pexels dev team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-16 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: requests