pexels_api_client 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5cbd9207fe76696dc9ebd07e2c893daeda0f4eb77b8f89351ba60630ada76994
4
+ data.tar.gz: 0ad22972470b2160e0344f5b5a774af617499591c79c348366909f98d77d8c4a
5
+ SHA512:
6
+ metadata.gz: 6a388e183cc0f8d0e3ea0213bfa3fd14afab3cbe10b477581c9531db44d5537447fb65b7d6424e98e47fce9fc5a144e612638bd99b5e43ef6d8dea84db9638a1
7
+ data.tar.gz: e47f0739f40502f9365fc8ec5cdddeeaa2ad4b66609aed35289ba264653011849a8f6cbab813e2de103fbf2af276b088f1637e0d49d211ed417cfb1361d9632a
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,15 @@
1
+ image: "ruby:2.6"
2
+
3
+ before_script:
4
+ - ruby -v
5
+ - which ruby
6
+ - gem install bundler --no-document
7
+ - bundle install --jobs $(nproc) "${FLAGS[@]}"
8
+
9
+ rspec:
10
+ script:
11
+ - bundle exec rspec
12
+
13
+ rubocop:
14
+ script:
15
+ - bundle exec rubocop
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,29 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6.3
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ Metrics/LineLength:
8
+ Max: 190
9
+
10
+ Style/HashSyntax:
11
+ EnforcedStyle: ruby19
12
+
13
+ Metrics/MethodLength:
14
+ Exclude:
15
+ - 'spec/**/*'
16
+ - 'spec/support/fake_pexels.rb'
17
+ - 'pexels_api_client.gemspec'
18
+
19
+ Metrics/BlockLength:
20
+ Exclude:
21
+ - 'spec/**/*'
22
+ - 'spec/support/fake_pexels.rb'
23
+ - 'pexels_api_client.gemspec'
24
+
25
+ Metrics/ClassLength:
26
+ Exclude:
27
+ - 'spec/**/*'
28
+ - 'spec/support/fake_pexels.rb'
29
+ - 'pexels_api_client.gemspec'
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 2.0.2
File without changes
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at noragmora@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in pexels_api_client.gemspec
6
+ gemspec
@@ -0,0 +1,112 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pexels_api_client (0.1.4)
5
+ flexirest (~> 1.8.6)
6
+ json (~> 2.2.0)
7
+ rest-client (~> 2.1.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.0.1)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ zeitwerk (~> 2.2)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ ast (2.4.0)
21
+ bump (0.8.0)
22
+ concurrent-ruby (1.1.5)
23
+ crack (0.4.3)
24
+ safe_yaml (~> 1.0.0)
25
+ diff-lcs (1.3)
26
+ domain_name (0.5.20190701)
27
+ unf (>= 0.0.5, < 1.0.0)
28
+ faraday (0.17.1)
29
+ multipart-post (>= 1.2, < 3)
30
+ flexirest (1.8.6)
31
+ activesupport
32
+ crack
33
+ faraday
34
+ mime-types
35
+ multi_json
36
+ hashdiff (1.0.0)
37
+ http-accept (1.7.0)
38
+ http-cookie (1.0.3)
39
+ domain_name (~> 0.5)
40
+ i18n (1.7.0)
41
+ concurrent-ruby (~> 1.0)
42
+ jaro_winkler (1.5.4)
43
+ json (2.2.0)
44
+ mime-types (3.3)
45
+ mime-types-data (~> 3.2015)
46
+ mime-types-data (3.2019.1009)
47
+ minitest (5.13.0)
48
+ multi_json (1.14.1)
49
+ multipart-post (2.1.1)
50
+ netrc (0.11.0)
51
+ parallel (1.19.1)
52
+ parser (2.6.5.0)
53
+ ast (~> 2.4.0)
54
+ public_suffix (4.0.1)
55
+ rainbow (3.0.0)
56
+ rake (10.5.0)
57
+ rest-client (2.1.0)
58
+ http-accept (>= 1.7.0, < 2.0)
59
+ http-cookie (>= 1.0.2, < 2.0)
60
+ mime-types (>= 1.16, < 4.0)
61
+ netrc (~> 0.8)
62
+ rspec (3.9.0)
63
+ rspec-core (~> 3.9.0)
64
+ rspec-expectations (~> 3.9.0)
65
+ rspec-mocks (~> 3.9.0)
66
+ rspec-core (3.9.0)
67
+ rspec-support (~> 3.9.0)
68
+ rspec-expectations (3.9.0)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.9.0)
71
+ rspec-mocks (3.9.0)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.9.0)
74
+ rspec-support (3.9.0)
75
+ rubocop (0.77.0)
76
+ jaro_winkler (~> 1.5.1)
77
+ parallel (~> 1.10)
78
+ parser (>= 2.6)
79
+ rainbow (>= 2.2.2, < 4.0)
80
+ ruby-progressbar (~> 1.7)
81
+ unicode-display_width (>= 1.4.0, < 1.7)
82
+ ruby-progressbar (1.10.1)
83
+ safe_yaml (1.0.5)
84
+ thread_safe (0.3.6)
85
+ tzinfo (1.2.5)
86
+ thread_safe (~> 0.1)
87
+ unf (0.1.4)
88
+ unf_ext
89
+ unf_ext (0.0.7.6)
90
+ unicode-display_width (1.6.0)
91
+ vcr (5.0.0)
92
+ webmock (3.7.6)
93
+ addressable (>= 2.3.6)
94
+ crack (>= 0.3.2)
95
+ hashdiff (>= 0.4.0, < 2.0.0)
96
+ zeitwerk (2.2.2)
97
+
98
+ PLATFORMS
99
+ ruby
100
+
101
+ DEPENDENCIES
102
+ bump (~> 0.8.0)
103
+ bundler (~> 2.0)
104
+ pexels_api_client!
105
+ rake (~> 10.0)
106
+ rspec (~> 3.9.0)
107
+ rubocop (~> 0.77.0)
108
+ vcr (~> 5.0.0)
109
+ webmock (~> 3.7.6)
110
+
111
+ BUNDLED WITH
112
+ 2.0.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Nora Gabriela Alvarado
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,166 @@
1
+ # PexelsApiClient
2
+
3
+ PexelsApiClient its a Ruby wrapper for the [Pexels](https://www.pexels.com) API. Please read Pexel's [documentation](https://www.pexels.com/api/documentation/) on how to start using their API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'pexels_api_client'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install pexels_api_client
20
+
21
+ ## Usage
22
+
23
+ To start using the Pexel's API you'll first need to setup an [account](https://www.pexels.com/join/) on their site, once you have an account you will need to request an [Api Key](https://www.pexels.com/api/new/)
24
+
25
+ Now you can configure the gem with:
26
+
27
+ ```ruby
28
+ PexelsApiClient.config do |config|
29
+ config.api_key = '<API_KEY>'
30
+ end
31
+ ```
32
+
33
+ #### Photo Methods
34
+
35
+ * **Find**: If you have the id of a photo, you can retrieve the data of it.
36
+
37
+ ```ruby
38
+ photo = PexelsApiClient::Photo.find(id)
39
+ photo.width # => 1400
40
+ photo.photographer # => John Doe
41
+ # ...
42
+ ```
43
+
44
+ * **Curated**: Get a Curated list of trending photos.
45
+
46
+ | **Param** | **Description** |
47
+ | ------ | ------ |
48
+ | **per_page** | Defines the number of results per page. (optional, default: 15, max: 80) |
49
+ | **page** | Defines the number of the page. (optional, default: 1) |
50
+
51
+ ```ruby
52
+ curated_photos = PexelsApiClient::Photo.curated # => Fallback to default options
53
+ -- or --
54
+ curated_photos = PexelsApiClient::Photo.curated(per_page: 5, page: 2) # => With custom options
55
+
56
+ curated_photos.photos # => [photo1, photo2,etc]
57
+ curated_photos.photos.first.photographer # => John Doe
58
+ # ...
59
+ ```
60
+
61
+ * **Random**: Returns a random photo from the curated photos
62
+
63
+ ```ruby
64
+ random_photo = PexelsApiClient::Photo.random
65
+
66
+ random_photo.photos # => [photo1]
67
+ random_photo.photos.first.photographer # => John Doe
68
+ # ...
69
+ ```
70
+
71
+ * **Search**: Search for photos related to a query
72
+
73
+ | **Param** | **Description** |
74
+ | ------ | ------ |
75
+ | **query** | Get photos related to this query. (required) |
76
+ | **per_page** | Defines the number of results per page. (optional, default: 15, max: 80) |
77
+ | **page** | Defines the number of the page. (optional, default: 1) |
78
+
79
+ ```ruby
80
+ search_photos = PexelsApiClient::Photo.search(per_page: 5, page: 2, query: 'people')
81
+
82
+ search_photos.photos # => [photo1, photo2,etc]
83
+ search_photos.photos.first.photographer # => John Doe
84
+ # ...
85
+ ```
86
+
87
+ #### Video Methods
88
+
89
+ * **Find**: If you have the id of a video, you can retrieve the data of it.
90
+
91
+ ```ruby
92
+ video = PexelsApiClient::Video.find(id)
93
+ video.width # => 1400
94
+ video.user.name # => John Doe
95
+ # ...
96
+ ```
97
+
98
+ * **Popular**: Get a list of popular videos.
99
+
100
+ | **Param** | **Description** |
101
+ | ------ | ------ |
102
+ | **per_page** | Defines the number of results per page. (optional, default: 15, max: 80) |
103
+ | **page** | Defines the number of the page. (optional, default: 1) |
104
+ | **min_width** | The minimum width in pixels of the returned videos. (optional, default: "") |
105
+ | **max_width** | The maximum width in pixels of the returned videos. (optional, default: "") |
106
+ | **min_duration** | The minimum duration in seconds of the returned videos. (optional, default: "")|
107
+ | **max_duration** | The maximum duration in seconds of the returned videos. (optional, default: "") |
108
+
109
+ ```ruby
110
+ popular_videos = PexelsApiClient::Video.popular # => Fallback to default options
111
+ -- or --
112
+ popular_videos = PexelsApiClient::Video.popular(per_page: 5, page: 2) # => With custom options
113
+
114
+ popular_videos.videos # => [video1, video2, etc]
115
+ popular_videos.videos.first.user.name # => John Doe
116
+ # ...
117
+ ```
118
+
119
+ * **Random**: Returns a random video from the popular videos
120
+
121
+ ```ruby
122
+ random_video = PexelsApiClient::Video.random
123
+
124
+ random_video.videos # => [photo1]
125
+ random_video.videos.first.user.name # => John Doe
126
+ # ...
127
+ ```
128
+
129
+ * **Search**: Search for videos related to a query
130
+
131
+
132
+ | **Param** | **Description** |
133
+ | ------ | ------ |
134
+ | **query** | Get videos related to this query. (required) |
135
+ | **per_page** | Defines the number of results per page. (optional, default: 15, max: 80) |
136
+ | **page** | Defines the number of the page. (optional, default: 1) |
137
+ | **min_width** | The minimum width in pixels of the returned videos. (optional, default: "") |
138
+ | **max_width** | The maximum width in pixels of the returned videos. (optional, default: "") |
139
+ | **min_duration** | The minimum duration in seconds of the returned videos. (optional, default: "")|
140
+ | **max_duration** | The maximum duration in seconds of the returned videos. (optional, default: "") |
141
+
142
+ ```ruby
143
+ search_videos = PexelsApiClient::Video.search(per_page: 5, page: 2, query: 'people')
144
+
145
+ search_videos.videos # => [video1, video2,etc]
146
+ search_videos.videos.first.user.name # => John Doe
147
+ # ...
148
+ ```
149
+
150
+ ## Development
151
+
152
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rspec spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
153
+
154
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
155
+
156
+ ## Contributing
157
+
158
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pexels_api_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
159
+
160
+ ## License
161
+
162
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
163
+
164
+ ## Code of Conduct
165
+
166
+ Everyone interacting in the PexelsApiClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](http://contributor-covenant.org)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ task default: :test
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'pexels_api_client'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'flexirest'
4
+
5
+ module PexelsApiClient
6
+ require 'pexels_api_client/errors'
7
+
8
+ autoload :Base, 'pexels_api_client/base'
9
+ autoload :Photo, 'pexels_api_client/photo'
10
+ autoload :Video, 'pexels_api_client/video'
11
+ autoload :Config, 'pexels_api_client/config'
12
+
13
+ BASE_URL = 'https://api.pexels.com/'
14
+
15
+ def self.config
16
+ if block_given?
17
+ yield(PexelsApiClient::Config)
18
+ else
19
+ PexelsApiClient::Config
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rest-client'
4
+
5
+ module PexelsApiClient
6
+ class Base < Flexirest::Base
7
+ after_request :rescue_errors
8
+
9
+ def rescue_errors(_name, response)
10
+ if (400..499).cover?(response.status)
11
+ result = JSON.parse(response.body)
12
+ message = result['errors'] || [result['error']]
13
+ raise BadRequestError, message.to_a.join(', ')
14
+ elsif (500..599).cover?(response.status)
15
+ raise ServerError, "Could not process your request: status #{response.status}"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PexelsApiClient
4
+ module Config
5
+ class << self
6
+ attr_reader :api_key, :base_url
7
+
8
+ def reset
9
+ @api_key = nil
10
+ @base_url = PexelsApiClient::BASE_URL
11
+ end
12
+
13
+ def api_key=(api_key)
14
+ @api_key = api_key
15
+ set_api_auth
16
+ end
17
+
18
+ def base_url=(base_url)
19
+ @base_url = base_url
20
+ set_api_auth
21
+ end
22
+
23
+ private
24
+
25
+ def set_api_auth
26
+ Flexirest::Base.base_url = base_url
27
+ Flexirest::Base.request_body_type = :json
28
+
29
+ Flexirest::Base.faraday_config do |faraday|
30
+ faraday.adapter(:net_http)
31
+ faraday.options.timeout = 10
32
+ faraday.headers['User-Agent'] = "Flexirest/#{Flexirest::VERSION}"
33
+ faraday.headers['Authorization'] = @api_key
34
+ end
35
+ end
36
+ end
37
+
38
+ reset
39
+ end
40
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PexelsApiClient
4
+ PexelsApiClientError = Class.new StandardError
5
+ BadRequestError = Class.new StandardError
6
+ ServerError = Class.new StandardError
7
+ ApiKeyError = Class.new StandardError
8
+ NotApiKeyError = Class.new ArgumentError
9
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PexelsApiClient
4
+ class Photo < PexelsApiClient::Base
5
+ get :curated, 'v1/curated', defaults: { per_page: 15, page: 1 }
6
+ get :random, 'v1/curated', defaults: { per_page: 1, page: rand(1..1000) }
7
+ get :search, 'v1/search', defaults: { per_page: 15, page: 1 }, required: [:query]
8
+ get :find, 'v1/photos/:id'
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PexelsApiClient
4
+ VERSION = '0.1.4'
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PexelsApiClient
4
+ class Video < PexelsApiClient::Base
5
+ get :find, 'videos/videos/:id'
6
+ get :popular, 'videos/popular', defaults: { per_page: 15, page: 1, min_width: '', max_width: '', min_duration: '', max_duration: '' }
7
+ get :random, 'videos/popular', defaults: { per_page: 1, page: rand(1..1000), min_width: '', max_width: '', min_duration: '', max_duration: '' }
8
+ get :search, 'videos/search', defaults: { per_page: 15, page: 1, min_width: '', max_width: '', min_duration: '', max_duration: '' }, required: [:query]
9
+ end
10
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'pexels_api_client/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'pexels_api_client'
9
+ spec.version = PexelsApiClient::VERSION
10
+ spec.authors = ['Nora Gabriela Alvarado']
11
+ spec.email = ['noragmora@gmail.com']
12
+
13
+ spec.summary = 'This gem is used to access the Pexels API.'
14
+ spec.description = 'Using this gem allows you to make requests to the Pexels API endpoints.'
15
+ spec.homepage = 'https://gitlab.com/aromaron/pexels_api_client'
16
+ spec.license = 'MIT'
17
+
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://gitlab.com/aromaron/pexels_api_client'
20
+ spec.metadata['changelog_uri'] = 'https://gitlab.com/aromaron/pexels_api_client/blob/master/CHANGELOG'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+ spec.required_ruby_version = '~> 2.6.3'
32
+
33
+ spec.add_runtime_dependency 'flexirest', '~> 1.8.6'
34
+ spec.add_runtime_dependency 'json', '~> 2.2.0'
35
+ spec.add_runtime_dependency 'rest-client', '~> 2.1.0'
36
+
37
+ spec.add_development_dependency 'bump', '~> 0.8.0'
38
+ spec.add_development_dependency 'bundler', '~> 2.0'
39
+ spec.add_development_dependency 'rake', '~> 10.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.9.0'
41
+ spec.add_development_dependency 'rubocop', '~> 0.77.0'
42
+ spec.add_development_dependency 'vcr', '~> 5.0.0'
43
+ spec.add_development_dependency 'webmock', '~> 3.7.6'
44
+ end
metadata ADDED
@@ -0,0 +1,208 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pexels_api_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - Nora Gabriela Alvarado
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: flexirest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rest-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bump
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.9.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 3.9.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.77.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.77.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: vcr
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 5.0.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 5.0.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 3.7.6
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 3.7.6
153
+ description: Using this gem allows you to make requests to the Pexels API endpoints.
154
+ email:
155
+ - noragmora@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".gitlab-ci.yml"
162
+ - ".rspec"
163
+ - ".rubocop.yml"
164
+ - ".travis.yml"
165
+ - CHANGELOG
166
+ - CODE_OF_CONDUCT.md
167
+ - Gemfile
168
+ - Gemfile.lock
169
+ - LICENSE.txt
170
+ - README.md
171
+ - Rakefile
172
+ - bin/console
173
+ - bin/setup
174
+ - lib/pexels_api_client.rb
175
+ - lib/pexels_api_client/base.rb
176
+ - lib/pexels_api_client/config.rb
177
+ - lib/pexels_api_client/errors.rb
178
+ - lib/pexels_api_client/photo.rb
179
+ - lib/pexels_api_client/version.rb
180
+ - lib/pexels_api_client/video.rb
181
+ - pexels_api_client.gemspec
182
+ homepage: https://gitlab.com/aromaron/pexels_api_client
183
+ licenses:
184
+ - MIT
185
+ metadata:
186
+ homepage_uri: https://gitlab.com/aromaron/pexels_api_client
187
+ source_code_uri: https://gitlab.com/aromaron/pexels_api_client
188
+ changelog_uri: https://gitlab.com/aromaron/pexels_api_client/blob/master/CHANGELOG
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
196
+ - !ruby/object:Gem::Version
197
+ version: 2.6.3
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubygems_version: 3.0.3
205
+ signing_key:
206
+ specification_version: 4
207
+ summary: This gem is used to access the Pexels API.
208
+ test_files: []