ika3 0.2.1 → 0.3.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: 010310a4b067b39dfd3c92a4a43fd7b8af48ff9cc5d6f513d73c967df69e14fd
4
- data.tar.gz: 410d4c6b446c85daf2675d06a611a4b8fc28f1653f62789843f4f8d94f7d18d4
3
+ metadata.gz: 3940b718fc2ccc5f0627bda37240d1b80e6349d35f0e139ce50bcdb0a849ceb5
4
+ data.tar.gz: 9497b125ea065ddd1e95e4ee808e36d4ad2f3a231641d38d7d1610f8f10d5af4
5
5
  SHA512:
6
- metadata.gz: 2b13ba634e97b1c8ee57871cce0f6ee57f0373fcf4e552afb4467395e9ff65c5604847da8fba11edb69be7f5b1df0e6a50898f18117198468363fe0aed4eb050
7
- data.tar.gz: ec349ce079c454f3e059aea4796839a06904e80ad0e1376008baac175e3472478d8dfce9ee3ecebcf4e8591c38e3a5aecbb733e4711e7a2fc48cb1e8532e7908
6
+ metadata.gz: 2ba30b98a1ead55ae553c399603aa5a83c7dd9b816fb624e7bba77004081f99faa3f83930162d5031f73e4d5633e5af10e95de399e8acf9ff8870e1eb6925300
7
+ data.tar.gz: fb015aaa7b2d88c70595dc5ae778a92d8404e2eb427b53414be65542ad6a967f710977ccab87d88baef9ee0e6dec0b86ffdbbefa754f19ff06ae07f3d8836818
data/.codespellrc ADDED
@@ -0,0 +1,2 @@
1
+ [codespell]
2
+ skip = .gem_rbs_collection,.git
@@ -0,0 +1,3 @@
1
+ {
2
+ "cSpell.words": ["Splatoon"]
3
+ }
data/Gemfile.lock CHANGED
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ika3 (0.2.1)
4
+ ika3 (0.3.0)
5
5
  activesupport (>= 5.0.0)
6
6
  faraday (>= 2.7.0)
7
- hashie (>= 2.0.5)
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
@@ -24,7 +23,6 @@ GEM
24
23
  faraday-net_http (3.0.2)
25
24
  ffi (1.15.5)
26
25
  fileutils (1.6.0)
27
- hashie (5.0.0)
28
26
  i18n (1.12.0)
29
27
  concurrent-ruby (~> 1.0)
30
28
  json (2.6.2)
data/README.md CHANGED
@@ -17,7 +17,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
17
17
  ## Usage
18
18
 
19
19
  ```ruby
20
- reuqire "ika3"
20
+ require "ika3"
21
21
  ```
22
22
 
23
23
  ### Find Weapon data
@@ -44,6 +44,33 @@ splatbombs
44
44
  {:name=>"パブロ", :sub=>"スプラボム", :special=>"メガホンレーザー5.1ch"}]
45
45
  ```
46
46
 
47
+ ### Get Schedule
48
+
49
+ Initialize with your contact information. e.g. Twitter, GitHub, Homepage URL and so on.
50
+
51
+ ```ruby
52
+ ika3_schedule = Ika3::Schedule.new('GitHub@YutaGoto')
53
+ ika3_schedule.bankara_challenge_next
54
+ =>
55
+ {"start_time"=>"2023-02-07T13:00:00+09:00",
56
+ "end_time"=>"2023-02-07T15:00:00+09:00",
57
+ "rule"=>{"key"=>"LOFT", "name"=>"ガチヤグラ"},
58
+ "stages"=>
59
+ [{"id"=>9,
60
+ "name"=>"ヒラメが丘団地",
61
+ "image"=> "https://....."},
62
+ {"id"=>11,
63
+ "name"=>"キンメダイ美術館",
64
+ "image"=> "https://...."}],
65
+ "is_fest"=>false}
66
+ ```
67
+
68
+ ## Note
69
+
70
+ This gem is NOT related to Nintendo.
71
+
72
+ The Schedule is used an unofficial API. <https://spla3.yuu26.com/>
73
+
47
74
  ## Contributing
48
75
 
49
76
  Bug reports and pull requests are welcome on GitHub at https://github.com/YutaGoto/ika3.
data/Steepfile CHANGED
@@ -3,6 +3,5 @@ target :lib do
3
3
 
4
4
  check "lib"
5
5
  repo_path ".gem_rbs_collection"
6
- library "hashie"
7
6
  end
8
7
 
data/ika3.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["YutaGoto"]
9
9
  spec.email = ["you.goto.510@gmail.com"]
10
10
 
11
- spec.summary = "Splatoon3 weapons infomation library."
12
- spec.description = "Splatoon3 weapons infomation library. This gem provide weapon name, sub, and special. not official"
11
+ spec.summary = "Splatoon3 weapons information library."
12
+ spec.description = "Splatoon3 weapons information library. This gem provide weapon name, sub, and special. not official"
13
13
  spec.homepage = "https://github.com/YutaGoto/ika3"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 2.7.0"
@@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency "faraday", ">= 2.7.0"
34
34
  spec.add_dependency "activesupport", ">= 5.0.0"
35
- spec.add_dependency "hashie", ">= 2.0.5"
36
35
 
37
36
  # For more information and examples about making a new gem, check out our
38
37
  # guide at: https://bundler.io/guides/creating_gem.html
data/lib/ika3/schedule.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class Hash
2
2
  def method_missing(name)
3
- return self[name].extend Hash if key? name
3
+ return self[name] if key? name
4
4
 
5
5
  each { |k, v| return v if k.to_s.to_sym == name }
6
6
  super.method_missing(name)
@@ -9,48 +9,55 @@ end
9
9
 
10
10
  module Ika3
11
11
  class Schedule
12
- class << self
13
- modes = ["regular", "bankara_challenge", "bankara_open", "x"]
14
- schedules = ["now", "next"]
15
-
16
- schedules.each do |schedule|
17
- modes.each do |mode|
18
- define_method("#{mode}_#{schedule}".to_sym) do
19
- return instance_variable_get("@#{mode}_#{schedule}_obj") if instance_variable_defined?("@#{mode}_#{schedule}_obj")
12
+ def initialize(contact)
13
+ @contact = contact
14
+ end
20
15
 
21
- instance_variable_set("@#{mode}_#{schedule}_obj", send_request(:get, "/api/#{mode.dasherize}/#{schedule}").body.results[0])
22
- end
23
- end
16
+ modes = ["regular", "bankara_challenge", "bankara_open", "x"]
17
+ schedules = ["now", "next"]
24
18
 
25
- define_method("salmon_run_#{schedule}".to_sym) do
26
- return instance_variable_get("@salmon_run_#{schedule}_obj") if instance_variable_defined?("@salmon_run_#{schedule}_obj")
19
+ schedules.each do |schedule|
20
+ modes.each do |mode|
21
+ define_method("#{mode}_#{schedule}".to_sym) do
22
+ return instance_variable_get("@#{mode}_#{schedule}_obj") if instance_variable_defined?("@#{mode}_#{schedule}_obj")
27
23
 
28
- instance_variable_set("@salmon_run_#{schedule}_obj", send_request(:get, "/api/coop-grouping/#{schedule}").body.results[0])
24
+ instance_variable_set("@#{mode}_#{schedule}_obj", send_request(:get, "/api/#{mode.dasherize}/#{schedule}").body.results[0])
29
25
  end
30
26
  end
31
27
 
32
- private
28
+ define_method("salmon_run_#{schedule}".to_sym) do
29
+ return instance_variable_get("@salmon_run_#{schedule}_obj") if instance_variable_defined?("@salmon_run_#{schedule}_obj")
33
30
 
34
- def send_request(method, path, params = nil, headers = nil)
35
- response = splat3_connection.send(method, path, params, headers)
36
- Ika3::Response.new(response)
31
+ instance_variable_set("@salmon_run_#{schedule}_obj", send_request(:get, "/api/coop-grouping/#{schedule}").body.results[0])
37
32
  end
33
+ end
38
34
 
39
- def api_url
40
- "https://spla3.yuu26.com/"
41
- end
35
+ private
42
36
 
43
- def splat3_connection
44
- @splat3_connection ||= Faraday::new(faraday_options) do |c|
45
- c.request :json
46
- c.response :json
47
- c.adapter Faraday.default_adapter
48
- end
49
- end
37
+ def send_request(method, path)
38
+ response = splat3_connection.send(method, path)
39
+ Ika3::Response.new(response)
40
+ end
41
+
42
+ def api_url
43
+ "https://spla3.yuu26.com/"
44
+ end
50
45
 
51
- def faraday_options
52
- { url: api_url }
46
+ def splat3_connection
47
+ @splat3_connection ||= Faraday::new(faraday_options) do |c|
48
+ c.request :json
49
+ c.response :json
50
+ c.adapter Faraday.default_adapter
53
51
  end
54
52
  end
53
+
54
+ def faraday_options
55
+ {
56
+ url: api_url,
57
+ headers: {
58
+ 'User-Agent': "Ika3Gem/#{Ika3::VERSION}(#{@contact})"
59
+ }
60
+ }
61
+ end
55
62
  end
56
63
  end
data/lib/ika3/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ika3
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/ika3/weapons.rb CHANGED
@@ -1,13 +1,9 @@
1
1
  module Ika3
2
- class Weapon < Hash
3
- include Hashie::Extensions::MethodAccess
4
-
2
+ class Weapon
5
3
  ATTRIBUTES = [
6
4
  :name, :sub, :special
7
5
  ].freeze
8
6
 
9
- attr_accessor :io
10
-
11
7
  ATTRIBUTES.each do |attribute|
12
8
  define_method attribute do
13
9
  self[attribute]
@@ -23,7 +19,7 @@ module Ika3
23
19
  @cache ||= {}
24
20
  unless @cache[weapon_key]
25
21
  weapon_config = config[weapon_key] || {}
26
- @cache[weapon_key] = Ika3::Weapon[weapon_config].tap {|weapon| weapon.io = $stdout}
22
+ @cache[weapon_key] = weapon_config
27
23
  end
28
24
 
29
25
  @cache[weapon_key]
data/lib/ika3.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yaml"
4
- require "hashie"
5
4
 
6
5
  require "active_support/core_ext/hash/keys"
7
6
  require "active_support/core_ext/string/inflections"
@@ -6,34 +6,42 @@ sources:
6
6
  repo_dir: gems
7
7
  path: ".gem_rbs_collection"
8
8
  gems:
9
- - name: hashie
10
- version: '5.0'
9
+ - name: activesupport
10
+ version: '7.0'
11
11
  source:
12
12
  type: git
13
13
  name: ruby/gem_rbs_collection
14
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
14
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
15
15
  remote: https://github.com/ruby/gem_rbs_collection.git
16
16
  repo_dir: gems
17
- - name: activesupport
18
- version: '6.0'
17
+ - name: ast
18
+ version: '2.4'
19
19
  source:
20
20
  type: git
21
21
  name: ruby/gem_rbs_collection
22
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
22
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
23
23
  remote: https://github.com/ruby/gem_rbs_collection.git
24
24
  repo_dir: gems
25
- - name: ast
26
- version: '2.4'
25
+ - name: concurrent-ruby
26
+ version: '1.1'
27
27
  source:
28
28
  type: git
29
29
  name: ruby/gem_rbs_collection
30
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
30
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
31
31
  remote: https://github.com/ruby/gem_rbs_collection.git
32
32
  repo_dir: gems
33
33
  - name: csv
34
34
  version: '0'
35
35
  source:
36
36
  type: stdlib
37
+ - name: faraday
38
+ version: '2.5'
39
+ source:
40
+ type: git
41
+ name: ruby/gem_rbs_collection
42
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
43
+ remote: https://github.com/ruby/gem_rbs_collection.git
44
+ repo_dir: gems
37
45
  - name: fileutils
38
46
  version: '0'
39
47
  source:
@@ -43,13 +51,9 @@ gems:
43
51
  source:
44
52
  type: git
45
53
  name: ruby/gem_rbs_collection
46
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
54
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
47
55
  remote: https://github.com/ruby/gem_rbs_collection.git
48
56
  repo_dir: gems
49
- - name: ika3
50
- version: 0.1.0
51
- source:
52
- type: rubygems
53
57
  - name: json
54
58
  version: '0'
55
59
  source:
@@ -59,7 +63,7 @@ gems:
59
63
  source:
60
64
  type: git
61
65
  name: ruby/gem_rbs_collection
62
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
66
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
63
67
  remote: https://github.com/ruby/gem_rbs_collection.git
64
68
  repo_dir: gems
65
69
  - name: logger
@@ -75,7 +79,7 @@ gems:
75
79
  source:
76
80
  type: git
77
81
  name: ruby/gem_rbs_collection
78
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
82
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
79
83
  remote: https://github.com/ruby/gem_rbs_collection.git
80
84
  repo_dir: gems
81
85
  - name: rainbow
@@ -83,7 +87,7 @@ gems:
83
87
  source:
84
88
  type: git
85
89
  name: ruby/gem_rbs_collection
86
- revision: 0a45b6d56b0e1b089731f5eb007912a7c36be121
90
+ revision: c42c09528dd99252db98f0744181a6de54ec2f55
87
91
  remote: https://github.com/ruby/gem_rbs_collection.git
88
92
  repo_dir: gems
89
93
  - name: securerandom
@@ -91,26 +95,26 @@ gems:
91
95
  source:
92
96
  type: stdlib
93
97
  - name: steep
94
- version: 1.2.1
98
+ version: 1.3.0
95
99
  source:
96
100
  type: rubygems
97
101
  - name: strscan
98
102
  version: '0'
99
103
  source:
100
104
  type: stdlib
101
- - name: monitor
105
+ - name: date
102
106
  version: '0'
103
107
  source:
104
108
  type: stdlib
105
- - name: date
109
+ - name: monitor
106
110
  version: '0'
107
111
  source:
108
112
  type: stdlib
109
- - name: singleton
113
+ - name: mutex_m
110
114
  version: '0'
111
115
  source:
112
116
  type: stdlib
113
- - name: mutex_m
117
+ - name: singleton
114
118
  version: '0'
115
119
  source:
116
120
  type: stdlib
@@ -118,11 +122,12 @@ gems:
118
122
  version: '0'
119
123
  source:
120
124
  type: stdlib
121
- - name: pathname
125
+ - name: forwardable
122
126
  version: '0'
123
127
  source:
124
128
  type: stdlib
125
- - name: forwardable
129
+ - name: uri
126
130
  version: '0'
127
131
  source:
128
132
  type: stdlib
133
+ gemfile_lock_path: Gemfile.lock
data/rbs_collection.yaml CHANGED
@@ -13,4 +13,3 @@ gems:
13
13
  # It's unnecessary if you don't use rbs as a library.
14
14
  - name: rbs
15
15
  ignore: true
16
- - name: hashie
@@ -0,0 +1,19 @@
1
+ class Hash[unchecked out K, unchecked out V] < Object
2
+ def method_missing: (name: String) -> untyped
3
+ end
4
+
5
+ module Ika3
6
+ class Schedule
7
+ def initialize: (contact: String) -> void
8
+
9
+ private
10
+
11
+ def send_request: (method: String, path: String) -> Object
12
+
13
+ def api_url: () -> "https://spla3.yuu26.com/"
14
+
15
+ def splat3_connection: () -> untyped
16
+
17
+ def faraday_options: () -> { url: String, headers: { :"User-Agent" => ::String } }
18
+ end
19
+ end
data/sig/ika3/weapon.rbs CHANGED
@@ -1,11 +1,7 @@
1
1
  module Ika3
2
- class Weapon < Hash
3
- include Hashie::Extensions::MethodAccess
4
-
2
+ class Weapon
5
3
  ATTRIBUTES: ::Array[:name | :sub | :special]
6
4
 
7
- attr_accessor io: untyped
8
-
9
5
  include Ika3::Concerns::Utils
10
6
 
11
7
  def self.find: (untyped weapon_key) -> untyped
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ika3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YutaGoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-27 00:00:00.000000000 Z
11
+ date: 2023-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -38,29 +38,17 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 5.0.0
41
- - !ruby/object:Gem::Dependency
42
- name: hashie
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 2.0.5
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 2.0.5
55
- description: Splatoon3 weapons infomation library. This gem provide weapon name, sub,
56
- and special. not official
41
+ description: Splatoon3 weapons information library. This gem provide weapon name,
42
+ sub, and special. not official
57
43
  email:
58
44
  - you.goto.510@gmail.com
59
45
  executables: []
60
46
  extensions: []
61
47
  extra_rdoc_files: []
62
48
  files:
49
+ - ".codespellrc"
63
50
  - ".rspec"
51
+ - ".vscode/settings.json"
64
52
  - Gemfile
65
53
  - Gemfile.lock
66
54
  - LICENSE.txt
@@ -80,6 +68,7 @@ files:
80
68
  - rbs_collection.yaml
81
69
  - sig/ika3.rbs
82
70
  - sig/ika3/concerns/utils.rbs
71
+ - sig/ika3/schedule.rbs
83
72
  - sig/ika3/weapon.rbs
84
73
  homepage: https://github.com/YutaGoto/ika3
85
74
  licenses:
@@ -102,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
91
  - !ruby/object:Gem::Version
103
92
  version: '0'
104
93
  requirements: []
105
- rubygems_version: 3.4.3
94
+ rubygems_version: 3.4.6
106
95
  signing_key:
107
96
  specification_version: 4
108
- summary: Splatoon3 weapons infomation library.
97
+ summary: Splatoon3 weapons information library.
109
98
  test_files: []