tanoshimu 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +68 -0
- data/Rakefile +27 -0
- data/lib/tanoshimu.rb +15 -0
- data/lib/tanoshimu/active_resource.rb +4 -0
- data/lib/tanoshimu/show.rb +9 -0
- data/lib/tanoshimu/show/episode.rb +5 -0
- data/lib/tanoshimu/version.rb +3 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '089a9d8d37cf35d4538f448aade5a732fd8231eebc45907cf26e50ade8c8676d'
|
4
|
+
data.tar.gz: d7feadf63693694a886b861281df3e1cf340b540afcb00129f647a3d94ddaf4d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e5d13a81efab9d4b2f0ac6132bcac72cf28ea7d2580555622701b6082ff7d0671279922cd7a4322b5f9fbf94cec0a6e3fb022fcd77fa08ce8c6cf4c6840455b3
|
7
|
+
data.tar.gz: 442c7a15bb39ede7be1f8166d6a6995af7fa7a76f286f34610b9d47dff75ecd0b207637ce4e567ebac20c399dfd28f3866e1b0eba37aacf660592e8407453db7
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# gem tanoshimu
|
2
|
+
API for viewing the available shows and episodes.
|
3
|
+
|
4
|
+
## Requirements
|
5
|
+
Prior to installing, please make sure these gems can be installed on your
|
6
|
+
system:
|
7
|
+
- activeresource (v5.2.3+)
|
8
|
+
|
9
|
+
If you wish to run this gem locally, the following gems are also to consider:
|
10
|
+
- pry
|
11
|
+
- dotenv
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'tanoshimu'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
```bash
|
22
|
+
$ bundle
|
23
|
+
```
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
```bash
|
27
|
+
$ gem install tanoshimu
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
Here are the most relevant API entries from this Gem:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
### Check the version
|
35
|
+
Tanoshimu::VERSION
|
36
|
+
|
37
|
+
### Get all shows
|
38
|
+
shows = Tanoshimu::Show.all
|
39
|
+
|
40
|
+
### Get a show, and it's episode
|
41
|
+
### Please note you need to know a show's id
|
42
|
+
show = Tanoshimu::Show.find(<your id>)
|
43
|
+
episodes = show.episodes
|
44
|
+
end
|
45
|
+
|
46
|
+
# Or
|
47
|
+
operation = Operations::Operation.new{name: :my_operation, scope: :admin}
|
48
|
+
|
49
|
+
# Instance variable
|
50
|
+
allowed_users = operation.users # Returns a list of users based on the scope
|
51
|
+
is_valid = operation.is_valid? # For validation purposes
|
52
|
+
|
53
|
+
### Core extensions
|
54
|
+
# Convert a string to a list of Operations::Operations
|
55
|
+
"bf9[..]a248".to_operation # From a UUID (example truncated)
|
56
|
+
"{\"name\":\"my_operation\",\"scope\":\"admin\"}".to_operation # From a valid JSON string
|
57
|
+
```
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
Do you wish to contribute? It's simple! All you need to do is:
|
61
|
+
- Fork this project
|
62
|
+
- Work your magic (ie: write your code)
|
63
|
+
- **RUN TESTS**
|
64
|
+
- _Don't forget to rebase with master!_
|
65
|
+
- Open a pull request!
|
66
|
+
|
67
|
+
## License
|
68
|
+
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,27 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Operations'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.libs << 'spec'
|
23
|
+
t.pattern = 'spec/**/*_test.rb'
|
24
|
+
t.verbose = false
|
25
|
+
end
|
26
|
+
|
27
|
+
task default: :test
|
data/lib/tanoshimu.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
begin
|
2
|
+
require 'dotenv/load'
|
3
|
+
rescue LoadError
|
4
|
+
# ignore
|
5
|
+
end
|
6
|
+
require 'activeresource'
|
7
|
+
|
8
|
+
module Tanoshimu
|
9
|
+
::ActiveResource::Base.site = ENV.fetch('TANOSHIMU_URL') { 'https://anime.akinyele.ca/api/v1' }
|
10
|
+
::ActiveResource::Base.connection.auth_type = :bearer
|
11
|
+
::ActiveResource::Base.connection.bearer_token = ENV.fetch('TANOSHIMU_TOKEN') { 'demo' }
|
12
|
+
end
|
13
|
+
|
14
|
+
require_relative 'tanoshimu/version'
|
15
|
+
require_relative 'tanoshimu/show'
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tanoshimu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Akinyele Cafe-Febrissy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activeresource
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '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'
|
69
|
+
description: Simple REST api for anime.akinyele.ca
|
70
|
+
email:
|
71
|
+
- akinyele.kafe.febrissy@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- README.md
|
77
|
+
- Rakefile
|
78
|
+
- lib/tanoshimu.rb
|
79
|
+
- lib/tanoshimu/active_resource.rb
|
80
|
+
- lib/tanoshimu/show.rb
|
81
|
+
- lib/tanoshimu/show/episode.rb
|
82
|
+
- lib/tanoshimu/version.rb
|
83
|
+
homepage: https://anime.akinyele.ca
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.0.2
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: '# gem tanoshimu API for viewing the available shows and episodes. ## Requirements
|
106
|
+
Prior to installing, please make sure these gems can be installed on your system:
|
107
|
+
- activeresource (v5.2.3+) If you wish to run this gem locally, the following gems
|
108
|
+
are also to consider: - pry - dotenv ## Installation Add this line to your application''s
|
109
|
+
Gemfile: ```ruby gem ''tanoshimu'' ``` And then execute: ```bash $ bundle ``` Or
|
110
|
+
install it yourself as: ```bash $ gem install tanoshimu ``` ## Usage Here are the
|
111
|
+
most relevant API entries from this Gem: ```ruby ### Check the version Tanoshimu::VERSION ###
|
112
|
+
Get all shows shows = Tanoshimu::Show.all ### Get a show, and it''s episode ###
|
113
|
+
Please note you need to know a show''s id show = Tanoshimu::Show.find(<your id>)
|
114
|
+
episodes = show.episodes end # Or operation = Operations::Operation.new{name: :my_operation,
|
115
|
+
scope: :admin} # Instance variable allowed_users = operation.users # Returns
|
116
|
+
a list of users based on the scope is_valid = operation.is_valid? # For validation
|
117
|
+
purposes ### Core extensions # Convert a string to a list of Operations::Operations
|
118
|
+
"bf9[..]a248".to_operation # From a UUID (example truncated) "{\"name\":\"my_operation\",\"scope\":\"admin\"}".to_operation
|
119
|
+
# From a valid JSON string ``` ## Contributing Do you wish to contribute? It''s
|
120
|
+
simple! All you need to do is: - Fork this project - Work your magic (ie: write
|
121
|
+
your code) - **RUN TESTS** - _Don''t forget to rebase with master!_ - Open a pull
|
122
|
+
request! ## License The gem is available as open source under the terms of the
|
123
|
+
[MIT License](https://opensource.org/licenses/MIT).'
|
124
|
+
test_files: []
|