owen_wows 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 350daf847c4234fbc11cc470da764020347617de9c26b2d29443efbbb2abe9dc
4
+ data.tar.gz: b40c1531ff4040bb03267767d5e6b16081ebb7c212bc3ca0df230d51ee444f01
5
+ SHA512:
6
+ metadata.gz: d11f8230b47724624e4ec59c3a00fccfa7b14e7c17dfec050b8f110854124bf1f97fec3b2b34900f0bcd3ec424592fa02b4744c9380196548473902a87c53a11
7
+ data.tar.gz: 3a8760dd7587565c222fef963cd5cad85aebbcb07b009bf90b4c8fd561c28d388ac50f2e7104cf9cd8d28c8f0ef0b895412053f552c95ba71d5eb4f65c9dfeba
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # system / ide files
14
+ .idea/
15
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0.1
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in owen_wows.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ owen_wows (0.1.0)
5
+ faraday (= 2.2.0)
6
+ hashie (= 5.0.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ diff-lcs (1.5.0)
13
+ faraday (2.2.0)
14
+ faraday-net_http (~> 2.0)
15
+ ruby2_keywords (>= 0.0.4)
16
+ faraday-net_http (2.0.2)
17
+ hashie (5.0.0)
18
+ parallel (1.22.1)
19
+ parser (3.1.2.0)
20
+ ast (~> 2.4.1)
21
+ rainbow (3.1.1)
22
+ rake (13.0.6)
23
+ regexp_parser (2.3.1)
24
+ rexml (3.2.5)
25
+ rspec (3.11.0)
26
+ rspec-core (~> 3.11.0)
27
+ rspec-expectations (~> 3.11.0)
28
+ rspec-mocks (~> 3.11.0)
29
+ rspec-core (3.11.0)
30
+ rspec-support (~> 3.11.0)
31
+ rspec-expectations (3.11.0)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.11.0)
34
+ rspec-mocks (3.11.1)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.11.0)
37
+ rspec-support (3.11.0)
38
+ rubocop (1.28.2)
39
+ parallel (~> 1.10)
40
+ parser (>= 3.1.0.0)
41
+ rainbow (>= 2.2.2, < 4.0)
42
+ regexp_parser (>= 1.8, < 3.0)
43
+ rexml
44
+ rubocop-ast (>= 1.17.0, < 2.0)
45
+ ruby-progressbar (~> 1.7)
46
+ unicode-display_width (>= 1.4.0, < 3.0)
47
+ rubocop-ast (1.17.0)
48
+ parser (>= 3.1.1.0)
49
+ ruby-progressbar (1.11.0)
50
+ ruby2_keywords (0.0.5)
51
+ unicode-display_width (2.1.0)
52
+
53
+ PLATFORMS
54
+ x86_64-darwin-21
55
+
56
+ DEPENDENCIES
57
+ owen_wows!
58
+ rake (~> 13.0)
59
+ rspec (~> 3.0)
60
+ rubocop (~> 1.7)
61
+
62
+ BUNDLED WITH
63
+ 2.2.15
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Matt
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.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # OwenWows
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/owen_wows`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'owen_wows'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install owen_wows
22
+
23
+ ## Usage
24
+
25
+ ```azure
26
+ client = OwenWows::Client.new()
27
+ client.wows
28
+ client.random_wow
29
+ client.movies
30
+ client.directors
31
+ ```
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
+
37
+ 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/owen_wows.
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "owen_wows"
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
+ client = OwenWows::Client.new()
15
+
16
+ require "irb"
17
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -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,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "owen_wows/wow"
5
+ module OwenWows
6
+ class Client
7
+ BASE_URL = "https://owen-wilson-wow-api.herokuapp.com/wows/"
8
+ CURRENT_MOVIE_COUNT = 91
9
+ attr_reader :adapter
10
+
11
+ def initialize(adapter: Faraday.default_adapter)
12
+ @adapter = adapter
13
+ end
14
+
15
+ def connection
16
+ @connection ||= Faraday.new do |conn|
17
+ conn.url_prefix = BASE_URL
18
+ conn.request :json
19
+ conn.response :json, content_type: "application/json"
20
+ conn.adapter adapter
21
+ end
22
+ end
23
+
24
+ def list(results: CURRENT_MOVIE_COUNT)
25
+ wows = connection.get("random", { results: results }).body
26
+ wows.map { |wow| OwenWows::Wow.new(wow) }
27
+ end
28
+
29
+ def with_director(director)
30
+ wows = connection.get("random", { director: director }).body
31
+ wows.map { |wow| OwenWows::Wow.new(wow) }
32
+ end
33
+
34
+ def in_movie(movie, exact: true, results: CURRENT_MOVIE_COUNT)
35
+ wows = connection.get("random", { movie: movie, results: results }).body
36
+ all = wows.map { |wow| OwenWows::Wow.new(wow) }
37
+ return all unless exact
38
+
39
+ all.select { |wow| wow["movie"] == movie }
40
+ end
41
+
42
+ def all_movies
43
+ connection.get("movies").body
44
+ end
45
+
46
+ def all_directors
47
+ connection.get("directors").body
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OwenWows
4
+ class Error < StandardError; end
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OwenWows
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hashie/extensions/merge_initializer"
4
+ require "hashie/extensions/method_access"
5
+ module OwenWows
6
+ class Wow < Hash
7
+ include Hashie::Extensions::MergeInitializer
8
+ include Hashie::Extensions::MethodAccess
9
+ end
10
+ end
data/lib/owen_wows.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "owen_wows/version"
4
+
5
+ module OwenWows
6
+ autoload :Client, "owen_wows/client"
7
+ autoload :Error, "owen_wows/error"
8
+
9
+ end
data/owen_wows.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/owen_wows/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "owen_wows"
7
+ spec.version = OwenWows::VERSION
8
+ spec.authors = ["Matt Barry"]
9
+ spec.email = ["mbarry@gmail.com"]
10
+
11
+ spec.summary = "Ruby bindings for the Owen Wilson Wow API."
12
+ spec.description = "Search and view every time Owen Wilson said \"Wow\" in a movie." \
13
+ "See https://owen-wilson-wow-api.herokuapp.com/ for the API."
14
+ spec.homepage = "https://github.com/iubkud/owen-wows-ruby"
15
+ spec.license = "MIT"
16
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.1")
17
+
18
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "https://github.com/iubkud/owen-wow-api-ruby"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+
35
+ # For more information and examples about making a new gem, checkout our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ spec.add_dependency "faraday", "2.2.0"
38
+ spec.add_dependency "hashie", "5.0.0"
39
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: owen_wows
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Barry
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 5.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 5.0.0
41
+ description: Search and view every time Owen Wilson said "Wow" in a movie.See https://owen-wilson-wow-api.herokuapp.com/
42
+ for the API.
43
+ email:
44
+ - mbarry@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".rspec"
51
+ - ".rubocop.yml"
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - LICENSE.txt
55
+ - README.md
56
+ - Rakefile
57
+ - bin/console
58
+ - bin/setup
59
+ - lib/owen_wows.rb
60
+ - lib/owen_wows/client.rb
61
+ - lib/owen_wows/error.rb
62
+ - lib/owen_wows/version.rb
63
+ - lib/owen_wows/wow.rb
64
+ - owen_wows.gemspec
65
+ homepage: https://github.com/iubkud/owen-wows-ruby
66
+ licenses:
67
+ - MIT
68
+ metadata:
69
+ homepage_uri: https://github.com/iubkud/owen-wows-ruby
70
+ source_code_uri: https://github.com/iubkud/owen-wow-api-ruby
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 3.0.1
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.2.15
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Ruby bindings for the Owen Wilson Wow API.
90
+ test_files: []