get_xkcd 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5301e5087e8c893019aa4138e3f0c92899ee205e9c3e486e1de247b4457b4a3
4
- data.tar.gz: 1eb13ba9e7b41c303079978fd3918ce8ddb8b357382e68936da034c6617ed4db
3
+ metadata.gz: 7798cbacb6c05d2714a4ea66114cbeea050d7586a249340ac6662858dde1ab0a
4
+ data.tar.gz: b321cf8950a3b45bff3e85d5066b7c9a43c6ebd660d32f0fa4ece6648aa02004
5
5
  SHA512:
6
- metadata.gz: 2c234f460d68739ccbc3b428b7e073d790822683c50be67dc784a29ab138fa067c0ed3758cf4ea8b4e1f490c73eb3a0fc1700cc48de21c480a7d4e0763db8105
7
- data.tar.gz: 676fc885ae33537beb0ee2d713e9b845115a593dc3291555a4bf738f5919eb1ba666bd1c6593507a273c139374464368f2fb2fab5d28a187a526836a398bb92a
6
+ metadata.gz: 55c89f55e8c64d9eccfb97cfd2b559c0f5db11cd9d56ba8422fa2fc6087cc2c6c24e22d600265745a92dbd0843a99c6e7d501daeed7af7c4358e0dfb306dc3df
7
+ data.tar.gz: f6d22e3f705f2d3c693bd75229a4649481ba554e0f69c475c1acf87376adc8532ea3d00664405d6e7fbe313064efeda748e32ea29424bc54834f04bc27287414
@@ -0,0 +1,15 @@
1
+ name: Publish Gem
2
+ on:
3
+ release:
4
+ types: [published]
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v1
10
+ - name: Release Gem
11
+ uses: cadwallion/publish-rubygems-action@master
12
+ env:
13
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
14
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
15
+ RELEASE_COMMAND: rake release
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.2.0
2
+
3
+ * Adds functionality to get a specific issue
4
+ * Defines a `Comic::fetch_specific_issue_data` method
5
+ * Refactors the `Comic::fetch_random_issue_data` method to use `Comic::fetch_specific_issue_data`
6
+
1
7
  # 0.1.0
2
8
 
3
9
  * First version!
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- get_xkcd (0.1.0)
4
+ get_xkcd (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -63,4 +63,4 @@ DEPENDENCIES
63
63
  webmock (~> 3.0)
64
64
 
65
65
  BUNDLED WITH
66
- 2.2.3
66
+ 2.3.20
data/README.md CHANGED
@@ -36,6 +36,12 @@ Get data for the latest comic:
36
36
  latest_issue_data = GetXkcd::Comic.fetch_latest_issue_data
37
37
  ```
38
38
 
39
+ Get data for a specific comic:
40
+
41
+ ```ruby
42
+ specific_issue_data = GetXkcd::Comic.fetch_specific_issue_data(issue_number)
43
+ ```
44
+
39
45
  Get data for the a random comic:
40
46
 
41
47
  ```ruby
@@ -18,9 +18,9 @@ module GetXkcd
18
18
  JSON.parse(res.body)
19
19
  end
20
20
 
21
- # Get the json for the xkcd comic of a specific number
22
- def self.fetch_random_issue_data
23
- uri = URI("https://xkcd.com/#{generate_random_issue_number}/info.0.json")
21
+ # Get the json for the xkcd comic of a specific issue
22
+ def self.fetch_specific_issue_data(issue_number)
23
+ uri = URI("https://xkcd.com/#{issue_number}/info.0.json")
24
24
 
25
25
  req = Net::HTTP::Get.new(uri)
26
26
  req["Accept"] = "application/json"
@@ -31,6 +31,11 @@ module GetXkcd
31
31
  JSON.parse(res.body)
32
32
  end
33
33
 
34
+ # Get the json for the xkcd comic of a random issue
35
+ def self.fetch_random_issue_data
36
+ fetch_specific_issue_data(generate_random_issue_number)
37
+ end
38
+
34
39
  # Generate a random number up to the latest issue number (excluding 404)
35
40
  def self.generate_random_issue_number
36
41
  latest_issue_number = fetch_latest_issue_data["num"]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GetXkcd
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_xkcd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - superchilled
@@ -19,6 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - ".github/workflows/main.yml"
22
+ - ".github/workflows/release.yml"
22
23
  - ".gitignore"
23
24
  - ".rake_tasks~"
24
25
  - ".rspec"