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 +4 -4
- data/CHANGES.md +3 -0
- data/README.md +17 -0
- data/lib/pexels/client/collections.rb +11 -0
- data/lib/pexels/version.rb +1 -1
- data/test/collection_test.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e749787cf73bb5029e528f9d0232d2ce6c638dc81d13c12c7e91346b8962b2be
|
4
|
+
data.tar.gz: a531ae402dc483373295381e4fe613e0a169b813081a3964692b81d5af9bbaa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad853babd229b319f25253cf036d8fd97b7c9262de26566d36d7fec7ddd4d7a2240038b200f4fca0551e30608038c4de6cc6844594cc3c8720368d26dd49a7e6
|
7
|
+
data.tar.gz: aeda8080d6ad67c5aa1175081481337a2be0e7f1ed46619f2e5ccbee2944297b83aa7d3e4bae0df8949a04d80356a2e01f325dc539b874d6fa29e9b64f9e8906
|
data/CHANGES.md
CHANGED
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}",
|
data/lib/pexels/version.rb
CHANGED
data/test/collection_test.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: requests
|