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 +4 -4
- data/.github/workflows/release.yml +15 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +6 -0
- data/lib/get_xkcd/comic.rb +8 -3
- data/lib/get_xkcd/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7798cbacb6c05d2714a4ea66114cbeea050d7586a249340ac6662858dde1ab0a
|
4
|
+
data.tar.gz: b321cf8950a3b45bff3e85d5066b7c9a43c6ebd660d32f0fa4ece6648aa02004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/Gemfile.lock
CHANGED
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
|
data/lib/get_xkcd/comic.rb
CHANGED
@@ -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
|
22
|
-
def self.
|
23
|
-
uri = URI("https://xkcd.com/#{
|
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"]
|
data/lib/get_xkcd/version.rb
CHANGED
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.
|
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"
|