Class: Pexels::Client
- Inherits:
-
Object
- Object
- Pexels::Client
- Defined in:
- lib/pexels/client.rb,
lib/pexels/client/request.rb,
lib/pexels/client/response.rb
Defined Under Namespace
Classes: Collections, Photos, Request, Response, Videos
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#ratelimit_remaining ⇒ Object
readonly
Returns the value of attribute ratelimit_remaining.
Instance Method Summary collapse
- #collections ⇒ Object
-
#initialize(api_key = ENV['PEXELS_API_KEY']) ⇒ Client
constructor
A new instance of Client.
- #photos ⇒ Object
- #request(path, method: 'GET', params: {}) ⇒ Object
- #videos ⇒ Object
Constructor Details
#initialize(api_key = ENV['PEXELS_API_KEY']) ⇒ Client
Returns a new instance of Client.
6 7 8 |
# File 'lib/pexels/client.rb', line 6 def initialize(api_key = ENV['PEXELS_API_KEY']) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/pexels/client.rb', line 3 def api_key @api_key end |
#ratelimit_remaining ⇒ Object (readonly)
Returns the value of attribute ratelimit_remaining.
3 4 5 |
# File 'lib/pexels/client.rb', line 3 def ratelimit_remaining @ratelimit_remaining end |
Instance Method Details
#collections ⇒ Object
18 19 20 |
# File 'lib/pexels/client.rb', line 18 def collections @collections ||= Pexels::Client::Collections.new(self) end |
#photos ⇒ Object
10 11 12 |
# File 'lib/pexels/client.rb', line 10 def photos @photos ||= Pexels::Client::Photos.new(self) end |