pexels 0.0.2 → 0.0.3

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: 1affa62d97e31e4dbc5e93aa0aebbfd4305362f24c8a4b0d3a3b8c2b9f672cf1
4
- data.tar.gz: f9dc3eaf6a21abb49deaa5d722cf557f3da4fc9de50434297a3c9484343e7a08
3
+ metadata.gz: fd0b9df9874a218b1f0553181a9fafe4f78719c7323acd8b74015ed8c472f99c
4
+ data.tar.gz: 327f7cbd27a846c8a05cc1cb89061ec31e4aee6e885a2e6776b1c802ef3cc104
5
5
  SHA512:
6
- metadata.gz: 8c31177b1a17cf653580e84ee859f535c573627eb0ec7ca5d3ab3a67e96137aa79a4ce45dd7b050c819fd54ebc68dfd18b24d875be3937f2c449168ccda6ab69
7
- data.tar.gz: 5a6af1b335e3f723587cb716949e83417ec495730617946dc9eb3389f7cd8c3fee1e861ab5d2a29ffb448b86d857a190c4724e8f8e57a7291727391bc032bb70
6
+ metadata.gz: 3a0d3dacb30401f4d1e0de8322ec47f0e8949dbfe53b216832aa0a79361666f5cbb5c9838ab8ac904333537040d6a9639152b6ad7de5098325e1488619971116
7
+ data.tar.gz: 30d628a14aa5d60094501448caae6747deb8e4ea56f5b6e5cfa4c59da65bda750a3d3247c4f09b6bb47dec3a996335dca346d85470db0b65f07aee7c7c70a2b9
data/README.md CHANGED
@@ -17,13 +17,46 @@ See the API docs [here](https://www.pexels.com/api/documentation/?language=js)
17
17
 
18
18
  ## Basic usage
19
19
 
20
+ ### Create a client
21
+
20
22
  ```ruby
21
- client = Pexels::Client.new('your-access-key') #=> If you don't specify one, the environment variable PEXELS_API_KEY is used by default
23
+ # If you don't specify one, the environment variable PEXELS_API_KEY is used by default
24
+ client = Pexels::Client.new('your-access-key')
25
+ ```
26
+
27
+ ### Search for photos
22
28
 
29
+ ```ruby
23
30
  client.photos.search('Cloud')
31
+ ```
32
+
33
+ ### Find a specific photo
34
+
35
+ ```ruby
36
+ client.photos[2014422]
37
+ ```
38
+
39
+ ### Browse curated photos
40
+
41
+ ```ruby
24
42
  client.photos.curated
43
+ ```
44
+
45
+ ### Search for videos
25
46
 
47
+ ```ruby
26
48
  client.videos.search('waves')
49
+ ```
50
+
51
+ ### Find a specific photo
52
+
53
+ ```ruby
54
+ client.videos[2014422]
55
+ ```
56
+
57
+ ### Browse popular videos
58
+
59
+ ```ruby
27
60
  client.videos.popular
28
61
  ```
29
62
 
@@ -4,7 +4,7 @@ class Pexels::Client::Photos
4
4
  @client = client
5
5
  end
6
6
 
7
- def get(id)
7
+ def [](id)
8
8
  response = @client.request("/v1/photos/#{id}")
9
9
  Pexels::Photo.new(response)
10
10
  end
@@ -4,7 +4,7 @@ class Pexels::Client::Videos
4
4
  @client = client
5
5
  end
6
6
 
7
- def get(id)
7
+ def [](id)
8
8
  response = @client.request("/videos/videos/#{id}")
9
9
  Pexels::Video.new(response)
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module Pexels
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/test/photo_test.rb CHANGED
@@ -46,7 +46,7 @@ class TestPhoto < Minitest::Test
46
46
  end
47
47
 
48
48
  def test_get_photo
49
- photo = @client.photos.get(@photo.id)
49
+ photo = @client.photos[@photo.id]
50
50
 
51
51
  assert photo.is_a? Pexels::Photo
52
52
 
@@ -61,7 +61,7 @@ class TestPhoto < Minitest::Test
61
61
  end
62
62
 
63
63
  def test_invalid_get_photo
64
- photo = @client.photos.get('this-is-not-a-valid-id')
64
+ photo = @client.photos['this-is-not-a-valid-id']
65
65
  raise 'This should not happen'
66
66
  rescue StandardError => exception
67
67
  assert exception.is_a? Pexels::APIError
data/test/video_test.rb CHANGED
@@ -44,7 +44,7 @@ class TestVideo < Minitest::Test
44
44
  end
45
45
 
46
46
  def test_get_video
47
- video = @client.videos.get(@video.id)
47
+ video = @client.videos[@video.id]
48
48
 
49
49
  assert video.is_a? Pexels::Video
50
50
 
@@ -66,7 +66,7 @@ class TestVideo < Minitest::Test
66
66
  end
67
67
 
68
68
  def test_invalid_get_video
69
- video = @client.videos.get('this-is-not-a-valid-id')
69
+ video = @client.videos['this-is-not-a-valid-id']
70
70
  raise 'This should not happen'
71
71
  rescue StandardError => exception
72
72
  assert exception.is_a? Pexels::APIError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pexels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pexels dev team