bored 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5579caaa49fedb5fe996b66acbeabccb47387bdce42cfce16f121e7175096ae1
4
- data.tar.gz: fdc513c3ada2f1a8345852b032914d3a0f67e36764bba75758688c2c8d4776c1
3
+ metadata.gz: de2d7fa98a1ff3d173796e4595aea035f4a83adbb84b669db7edef52a48b2076
4
+ data.tar.gz: '089964fa3b1e46297afd7409ea9e19090a8f1734623ce7234e24feae2c4a0012'
5
5
  SHA512:
6
- metadata.gz: cc8222915fbf3a2959f17f07033f1752099fcd86d0a427d9dd827cb22d3ee492a927dd5cf345b9dc6a1d5d2d94f3bcbea4a8bdaf644570c23aabfdbbed0975e6
7
- data.tar.gz: f5cc6dd832b40ee2f3e20f93b1ce2095215bd752b612f8f1498e4fc454b4e831c3e1ce6e89183016cabc59ef2d48ccafeeb314d3244a76b754549854d66a4a6a
6
+ metadata.gz: 418912a5b8aaa4882be648875c3fb0baa4a6a21ba01bbf6030539fde1a40330358deda9fcae1edf8a13ee2252704b82feb7be353ca80c1a08322dbfa2535f37f
7
+ data.tar.gz: 7fa02e633472a344f6d01aca1fe83746c7d674caa6a7e528f8d99da023f473bbaef364bdffba709a86d1500f2f118fd550f4bb8b36aef70de7c0dac82e0e4157
data/.standard.yml CHANGED
@@ -1,4 +1,3 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
3
 
4
- default_ignores: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2022-05-19
4
+
5
+ - Add `--type` filter option in the CLI
6
+ [#15](https://github.com/testdouble/bored/pull/15) by
7
+ [@radglob](https://github.com/radglob) and
8
+ [@BrianBorge](@https://github.com/BrianBorge)
9
+
10
+ ## [0.1.0] - 2021-12-02
11
+
12
+ - Add filtering by Activity ID
13
+ [#12](https://github.com/testdouble/bored/pull/12) by
14
+ [@lsparlin](https://github.com/lsparlin)
15
+
16
+ - Add filtering by participant count
17
+ [#14](https://github.com/testdouble/bored/pull/14) by
18
+ [@jonathanpike](https://github.com/jonathanpike)
19
+
20
+ ## [0.0.2] - 2021-11-09
21
+
22
+ - Add `bored` CLI
23
+
3
24
  ## [0.0.1] - 2021-11-08
4
25
 
5
26
  - Add Bored.now() method, returning an activity
data/Gemfile CHANGED
@@ -1,12 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
1
  source "https://rubygems.org"
4
2
 
5
3
  # Specify your gem's dependencies in bored.gemspec
6
4
  gemspec
7
5
 
8
- gem "rake", "~> 13.0"
9
-
10
- gem "minitest", "~> 5.0"
11
-
12
- gem "standard", "~> 1.3"
6
+ gem "rake"
7
+ gem "minitest"
8
+ gem "standard"
9
+ gem "pry"
data/Gemfile.lock CHANGED
@@ -1,16 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bored (0.0.1)
4
+ bored (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
+ coderay (1.1.3)
11
+ method_source (1.0.0)
10
12
  minitest (5.14.4)
11
13
  parallel (1.21.0)
12
14
  parser (3.0.2.0)
13
15
  ast (~> 2.4.1)
16
+ pry (0.14.1)
17
+ coderay (~> 1.1)
18
+ method_source (~> 1.0)
14
19
  rainbow (3.0.0)
15
20
  rake (13.0.6)
16
21
  regexp_parser (2.1.1)
@@ -37,12 +42,15 @@ GEM
37
42
 
38
43
  PLATFORMS
39
44
  arm64-darwin-20
45
+ arm64-darwin-21
46
+ x86_64-linux
40
47
 
41
48
  DEPENDENCIES
42
49
  bored!
43
- minitest (~> 5.0)
44
- rake (~> 13.0)
45
- standard (~> 1.3)
50
+ minitest
51
+ pry
52
+ rake
53
+ standard
46
54
 
47
55
  BUNDLED WITH
48
- 2.3.0.dev
56
+ 2.3.14
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Justin Searls
3
+ Copyright (c) 2021 Test Double Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,43 +1,49 @@
1
1
  # Bored
2
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/bored`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This is a simple example gem developed for the conference talk ["How to make a
4
+ gem of a gem"](https://rubyconf.org/program/sessions#session-1203) at
5
+ [RubyConf](https://rubyconf.org) 2021.
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ The Bored gem calls the [Bored API](https://www.boredapi.com) and returns random
8
+ activity ideas.
6
9
 
7
10
  ## Installation
8
11
 
9
- Add this line to your application's Gemfile:
12
+ The installation process is boring, but familiar!
10
13
 
11
14
  ```ruby
12
- gem 'bored'
15
+ $ gem install bored
13
16
  ```
14
17
 
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install bored
22
-
23
18
  ## Usage
24
19
 
25
- TODO: Write usage instructions here
20
+ ### CLI
26
21
 
27
- ## Development
22
+ Once installed, run:
28
23
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+ ```
25
+ $ bored
26
+ ```
30
27
 
31
- 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).
28
+ And an activity will be printed. That's it!
32
29
 
33
- ## Contributing
30
+ ### API
34
31
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/searls/bored. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/searls/bored/blob/main/CODE_OF_CONDUCT.md).
32
+ To invoke the gem programmatically, just call:
36
33
 
37
- ## License
34
+ ```ruby
35
+ Bored.now
36
+ ```
38
37
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
38
+ This will return an
39
+ [Activity](https://github.com/testdouble/bored/blob/main/lib/bored.rb#L11-L15)
40
+ object.
40
41
 
41
42
  ## Code of Conduct
42
43
 
43
- Everyone interacting in the Bored project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/searls/bored/blob/main/CODE_OF_CONDUCT.md).
44
+ This project follows Test Double's [code of
45
+ conduct](https://testdouble.com/code-of-conduct) for all community interactions,
46
+ including (but not limited to) one-on-one communications, public posts/comments,
47
+ code reviews, pull requests, and GitHub issues. If violations occur, Test Double
48
+ will take any action they deem appropriate for the infraction, up to and
49
+ including blocking a user from the organization's repositories.
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require "rake/testtask"
5
3
 
data/bin/console CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
2
 
4
3
  require "bundler/setup"
5
4
  require "bored"
data/bored.gemspec CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require_relative "lib/bored/version"
4
2
 
5
3
  Gem::Specification.new do |spec|
data/exe/bored ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift("#{__dir__}/../lib")
4
+
5
+ require "bored"
6
+
7
+ Bored::Cli.new(ARGV).run
data/lib/bored/cli.rb ADDED
@@ -0,0 +1,25 @@
1
+ require "optparse"
2
+
3
+ module Bored
4
+ class Cli
5
+ def initialize(argv)
6
+ @argv = argv
7
+ end
8
+
9
+ def run
10
+ puts Bored.now(**params).description
11
+ end
12
+
13
+ private
14
+
15
+ def params
16
+ options = {}
17
+ OptionParser.new do |opts|
18
+ opts.on("--type TYPE", "Pick the type of activity") do |t|
19
+ options[:type] = t
20
+ end
21
+ end.parse!
22
+ options
23
+ end
24
+ end
25
+ end
data/lib/bored/version.rb CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Bored
4
- VERSION = "0.0.1"
2
+ VERSION = "0.2.0"
5
3
  end
data/lib/bored.rb CHANGED
@@ -1,8 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "net/http"
4
2
  require "json"
5
3
  require_relative "bored/version"
4
+ require_relative "bored/cli"
6
5
 
7
6
  module Bored
8
7
  class Error < StandardError; end
@@ -13,18 +12,29 @@ module Bored
13
12
  keyword_init: true
14
13
  )
15
14
 
16
- def self.now
17
- json = JSON.parse(Net::HTTP.get(
18
- "www.boredapi.com", "/api/activity"
19
- ))
20
- Activity.new(
21
- id: json["key"].to_i,
22
- description: json["activity"],
23
- type: json["type"].to_sym,
24
- participants: json["participants"],
25
- accessibility: json["accessibility"],
26
- price: json["price"],
27
- link: json["link"].empty? ? nil : json["link"]
28
- )
15
+ class << self
16
+ def now(params = {})
17
+ json = JSON.parse(Net::HTTP.get(uri(params)))
18
+ raise Error.new(json["error"]) if json["error"]
19
+
20
+ Activity.new(
21
+ id: json["key"].to_i,
22
+ description: json["activity"],
23
+ type: json["type"].to_sym,
24
+ participants: json["participants"],
25
+ accessibility: json["accessibility"],
26
+ price: json["price"],
27
+ link: json["link"].empty? ? nil : json["link"]
28
+ )
29
+ end
30
+
31
+ private
32
+
33
+ def uri(params)
34
+ uri = URI("https://www.boredapi.com/api/activity")
35
+ uri.query = URI.encode_www_form(params.compact)
36
+
37
+ uri
38
+ end
29
39
  end
30
40
  end
metadata CHANGED
@@ -1,25 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bored
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
15
15
  - searls@gmail.com
16
- executables: []
16
+ executables:
17
+ - bored
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - ".standard.yml"
21
22
  - CHANGELOG.md
22
- - CODE_OF_CONDUCT.md
23
23
  - Gemfile
24
24
  - Gemfile.lock
25
25
  - LICENSE.txt
@@ -28,7 +28,9 @@ files:
28
28
  - bin/console
29
29
  - bin/setup
30
30
  - bored.gemspec
31
+ - exe/bored
31
32
  - lib/bored.rb
33
+ - lib/bored/cli.rb
32
34
  - lib/bored/version.rb
33
35
  homepage: https://github.com/testdouble/bored
34
36
  licenses:
@@ -52,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
54
  - !ruby/object:Gem::Version
53
55
  version: '0'
54
56
  requirements: []
55
- rubygems_version: 3.2.29
57
+ rubygems_version: 3.3.6
56
58
  signing_key:
57
59
  specification_version: 4
58
60
  summary: Gives you ideas of stuff to do when you're bored
data/CODE_OF_CONDUCT.md DELETED
@@ -1,84 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ## Our Standards
10
-
11
- Examples of behavior that contributes to a positive environment for our community include:
12
-
13
- * Demonstrating empathy and kindness toward other people
14
- * Being respectful of differing opinions, viewpoints, and experiences
15
- * Giving and gracefully accepting constructive feedback
16
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
- * Focusing on what is best not just for us as individuals, but for the overall community
18
-
19
- Examples of unacceptable behavior include:
20
-
21
- * The use of sexualized language or imagery, and sexual attention or
22
- advances of any kind
23
- * Trolling, insulting or derogatory comments, and personal or political attacks
24
- * Public or private harassment
25
- * Publishing others' private information, such as a physical or email
26
- address, without their explicit permission
27
- * Other conduct which could reasonably be considered inappropriate in a
28
- professional setting
29
-
30
- ## Enforcement Responsibilities
31
-
32
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
-
34
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
-
36
- ## Scope
37
-
38
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
-
40
- ## Enforcement
41
-
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at searls@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
-
44
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
-
46
- ## Enforcement Guidelines
47
-
48
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
-
50
- ### 1. Correction
51
-
52
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
-
54
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
-
56
- ### 2. Warning
57
-
58
- **Community Impact**: A violation through a single incident or series of actions.
59
-
60
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
-
62
- ### 3. Temporary Ban
63
-
64
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
-
66
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
-
68
- ### 4. Permanent Ban
69
-
70
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
-
72
- **Consequence**: A permanent ban from any sort of public interaction within the community.
73
-
74
- ## Attribution
75
-
76
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
- available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
-
79
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
-
81
- [homepage]: https://www.contributor-covenant.org
82
-
83
- For answers to common questions about this code of conduct, see the FAQ at
84
- https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.