class Pexels::Client
Attributes
api_key[R]
ratelimit_remaining[R]
Public Class Methods
new(api_key = ENV['PEXELS_API_KEY'])
click to toggle source
# File lib/pexels/client.rb, line 6 def initialize(api_key = ENV['PEXELS_API_KEY']) @api_key = api_key end
Public Instance Methods
collections()
click to toggle source
# File lib/pexels/client.rb, line 18 def collections @collections ||= Pexels::Client::Collections.new(self) end
photos()
click to toggle source
# File lib/pexels/client.rb, line 10 def photos @photos ||= Pexels::Client::Photos.new(self) end
request(path, method: 'GET', params: {})
click to toggle source
# File lib/pexels/client.rb, line 22 def request(path, method: 'GET', params: {}) request = Request.new(api_key, path, method, params) request.call.tap do |response| @ratelimit_remaining = response.ratelimit_remaining end end
videos()
click to toggle source
# File lib/pexels/client.rb, line 14 def videos @videos ||= Pexels::Client::Videos.new(self) end