class Pixabay::Client

Public Class Methods

new(key: nil, timeout: 10) click to toggle source
# File lib/pixabay.rb, line 17
def initialize(key: nil, timeout: 10)
  @key = key
  @timeout = timeout
end

Public Instance Methods

photos(**options) click to toggle source
# File lib/pixabay.rb, line 22
def photos(**options)
  default_options = {
    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
  }

  options = { query: { key: @key }.merge(options) }
  self.class.get("", options)
end
videos(**options) click to toggle source
# File lib/pixabay.rb, line 34
def videos(**options)
  default_options = {
    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
  }

  options = { query: { key: @key }.merge(options) }
  self.class.get("/videos", options)
end