pixabay_api 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/examples/simple_request.rb +5 -3
- data/lib/pixabay_api/request.rb +1 -2
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '082b720cdec82b8a82da3e58b1f502c66959d022'
|
4
|
+
data.tar.gz: a24241bdb3c35a3ab6b381789a828ade60b6ae37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4267cac8b5ef077ae87af56f65830fc6a8576be6991b053c6491a503683d2725193754f967fb06b9cbace8b900d5cd5866be3d96eecc1e48ef8230e6a663983
|
7
|
+
data.tar.gz: 9755d184b178b82e60eaaab5ea62f8e171cf0a60e135a26af1f5c9acd65fdb63301a29c147098368e5eb46365ff01570d873a028916930bc98954957a4941241
|
data/README.md
CHANGED
@@ -43,7 +43,8 @@ You can configure as below:
|
|
43
43
|
|
44
44
|
```ruby
|
45
45
|
images_api = PixabayApi::ImagesApi.new
|
46
|
-
|
46
|
+
options = { id: 888 }
|
47
|
+
pictures = images_api.find(keyword: 'test', options: options)
|
47
48
|
|
48
49
|
p pictures.success?
|
49
50
|
p pictures.body['totalHits']
|
@@ -84,6 +85,7 @@ samples return
|
|
84
85
|
]
|
85
86
|
}
|
86
87
|
```
|
88
|
+
- There is many options - https://github.com/haanhduclinh/pixabay_api#search-images
|
87
89
|
|
88
90
|
## Get picture array data
|
89
91
|
|
@@ -209,6 +211,9 @@ To keep the Pixabay API fast for everyone, requests must be cached for 24 hours.
|
|
209
211
|
# Run test
|
210
212
|
- `bundle exec rspec`
|
211
213
|
|
214
|
+
# Require
|
215
|
+
- ruby 2.3
|
216
|
+
|
212
217
|
|
213
218
|
# Author
|
214
219
|
|
data/examples/simple_request.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'pixabay_api'
|
1
|
+
require './lib/pixabay_api'
|
2
2
|
|
3
3
|
PixabayApi.configure do |c|
|
4
4
|
c.api_key = '4339817-195df6b39f70c8fb254ba4656'
|
@@ -6,5 +6,7 @@ end
|
|
6
6
|
|
7
7
|
images_api = PixabayApi::ImagesApi.new
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
options = { id: 888 }
|
10
|
+
pictures = images_api.find_and_return_array(keyword: 'test', options: options)
|
11
|
+
p pictures.size
|
12
|
+
p pictures.first
|
data/lib/pixabay_api/request.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'resolv-replace'
|
4
|
-
require 'cgi'
|
5
4
|
|
6
5
|
module PixabayApi
|
7
6
|
class Request
|
@@ -23,7 +22,7 @@ module PixabayApi
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def params_to_s(params)
|
26
|
-
|
25
|
+
params.map { |k, v| "#{k}=#{v}" }.join('&')
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
data/lib/version.rb
CHANGED