Class: Pixabay::Client
Instance Method Summary collapse
-
#initialize(key: nil, timeout: 10) ⇒ Client
constructor
A new instance of Client.
- #photos(**options) ⇒ Object
- #videos(**options) ⇒ Object
Constructor Details
#initialize(key: nil, timeout: 10) ⇒ Client
Returns a new instance of Client.
17 18 19 20 |
# File 'lib/pixabay.rb', line 17 def initialize(key: nil, timeout: 10) @key = key @timeout = timeout end |
Instance Method Details
#photos(**options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pixabay.rb', line 22 def photos(**) = { q: nil, lang: "en", id: nil, response_group: "image_details", image_type: "all", orientation: "all", category: nil, min_width: 0, min_height: 0, editors_choice: false, safesearch: false, order: "popular", page: 1, per_page: 20, callback: nil, pretty: false } = { query: { key: @key }.merge() } self.class.get("", ) end |
#videos(**options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/pixabay.rb', line 34 def videos(**) = { q: nil, lang: "en", id: nil, video_type: "all", category: nil, min_width: 0, min_height: 0, editors_choice: false, safesearch: false, order: "popular", page: 1, per_page: 20, callback: nil, pretty: false } = { query: { key: @key }.merge() } self.class.get("/videos", ) end |