dimibob 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
+ SHA1:
3
+ metadata.gz: 20d0a707705864fa1ac6c1394f0c5a04dbec6829
4
+ data.tar.gz: 4eb8cd2944b0dfc4f8542fc615499d859d3fe7b2
5
+ SHA512:
6
+ metadata.gz: 668b1c1c1199eb2cd5a627be7233dd73e1f2b0d9077eda46b48d9e7968d0566111f1323f95121c7b8f5a61e4dd6951524930505382c6fc5704e130e8bbe2211b
7
+ data.tar.gz: b7221c919995f7dfbb245378bf69c6d61168aa9f6d3e9a966269743a091660f7d8242a531024f274e78e4b66c90cc004bcfe84b7caa5d18984ecb489bb77917f
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dimibob.gemspec
4
+ gemspec
5
+
6
+ gem 'rest-client', '~> 2.0', '>= 2.0.1'
7
+ gem 'json', '~> 2.0', '>= 2.0.3'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 CodeRi13
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,8 @@
1
+ # DIMI-BOB Gem
2
+
3
+ **DIMI-BOB** Gem for KoreanDigitalMediaHighSchool student.
4
+
5
+ ## Installation
6
+ $ gem install dimibob
7
+
8
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'dimibob'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ 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
data/dimibob.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dimibob/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'dimibob'
8
+ spec.version = Dimibob::VERSION
9
+ spec.authors = ['CodeRi13']
10
+ spec.email = ['ruto1924@gmail.com']
11
+
12
+ spec.summary = 'DIMI-BOB Viewer'
13
+ spec.description = 'You can take school meals of KoreanDigitalMediaHighSchool'
14
+ spec.homepage = 'https://github.com/CodeRi13/dimibob-gem'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.14'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
27
+ end
data/exe/dimibob ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dimibob'
data/lib/dimibob.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'dimibob/version'
2
+ require 'dimibob/bob_model'
3
+
4
+ # Dimibob Class
5
+ module Dimibob
6
+ def self.today(force = false)
7
+ BobModel.new.load_meal(Time.now, force)
8
+ end
9
+
10
+ def self.yesterday(force = false)
11
+ time = Time.now.day -= 1
12
+
13
+ BobModel.new.load_meal(time, force)
14
+ end
15
+
16
+ def self.tomorrow(force = false)
17
+ time = Time.now.day += 1
18
+
19
+ BobModel.new.load_meal(time, force)
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+
4
+ # BobModel
5
+ class BobModel
6
+ DIMIBOB_API_URL = 'http://dimigo.in/pages/dimibob_getdata.php?d='.freeze
7
+
8
+ def load_meal(time = Time.now, force = false)
9
+ return @bob unless @bob.nil? || !force
10
+
11
+ date = "#{time.year}#{time.month}#{time.day}"
12
+ response = RestClient.get DIMIBOB_API_URL + date
13
+
14
+ @bob = JSON.parse(response.body)
15
+ end
16
+
17
+ def breakfast(time = Time.now)
18
+ load_meal['breakfast'].split('/')
19
+ end
20
+
21
+ def lunch(time = Time.now)
22
+ load_meal['lunch'].split('/')
23
+ end
24
+
25
+ def dinner(time = Time.now)
26
+ load_meal['dinner'].split('/')
27
+ end
28
+
29
+ def snack(time = Time.now)
30
+ load_meal['snack'].split('/')
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module Dimibob
2
+ VERSION = '0.1.0'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dimibob
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - CodeRi13
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.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: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: You can take school meals of KoreanDigitalMediaHighSchool
56
+ email:
57
+ - ruto1924@gmail.com
58
+ executables:
59
+ - dimibob
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".idea/dimibob.iml"
65
+ - ".idea/misc.xml"
66
+ - ".idea/modules.xml"
67
+ - ".idea/workspace.xml"
68
+ - ".rspec"
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - dimibob.gemspec
76
+ - exe/dimibob
77
+ - lib/dimibob.rb
78
+ - lib/dimibob/bob_model.rb
79
+ - lib/dimibob/version.rb
80
+ homepage: https://github.com/CodeRi13/dimibob-gem
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.6.11
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: DIMI-BOB Viewer
104
+ test_files: []