laftel 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 +7 -0
- data/.idea/.gitignore +8 -0
- data/.idea/discord.xml +7 -0
- data/.idea/laftel.iml +52 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +25 -0
- data/README.md +5 -0
- data/Rakefile +4 -0
- data/laftel.gemspec +39 -0
- data/lib/laftel/version.rb +5 -0
- data/lib/laftel.rb +103 -0
- data/sig/laftel.rbs +4 -0
- metadata +59 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e2f8641eb28b4e2b90d76dedec2d49bc22d2874007a0e1ee81f4ecbc7857d417
|
|
4
|
+
data.tar.gz: 13da533b130420b853eb46a214490a77860126013374da446e785f6131c06a3a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d118b6470e527736da3d885db23b2355c1b634db981652d05d9454e043a2c341513fda478f98112270becb318faa308a59bc8fd2bea186b096071407683d3bda
|
|
7
|
+
data.tar.gz: 30ab9f52785155a788048203d324e4b2ad974b3b8a2c6e897cdc36b1088200147343d16d5193517d19708c6e2a04d189d9c9e954964955a334bcbe25ff2d5293
|
data/.idea/.gitignore
ADDED
data/.idea/discord.xml
ADDED
data/.idea/laftel.iml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$">
|
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
11
|
+
</content>
|
|
12
|
+
<orderEntry type="inheritedJdk" />
|
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.10, rbenv: 3.2.2) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.21.0, rbenv: 3.2.2) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.5, rbenv: 3.2.2) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 3.2.2) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 3.2.2) [gem]" level="application" />
|
|
19
|
+
</component>
|
|
20
|
+
<component name="RakeTasksCache">
|
|
21
|
+
<option name="myRootTask">
|
|
22
|
+
<RakeTaskImpl id="rake">
|
|
23
|
+
<subtasks>
|
|
24
|
+
<RakeTaskImpl description="Build laftel-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
|
|
25
|
+
<RakeTaskImpl id="build">
|
|
26
|
+
<subtasks>
|
|
27
|
+
<RakeTaskImpl description="Generate SHA512 checksum if laftel-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
|
28
|
+
</subtasks>
|
|
29
|
+
</RakeTaskImpl>
|
|
30
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
|
31
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
|
32
|
+
<RakeTaskImpl description="Build and install laftel-0.1.0.gem into system gems" fullCommand="install" id="install" />
|
|
33
|
+
<RakeTaskImpl id="install">
|
|
34
|
+
<subtasks>
|
|
35
|
+
<RakeTaskImpl description="Build and install laftel-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
|
36
|
+
</subtasks>
|
|
37
|
+
</RakeTaskImpl>
|
|
38
|
+
<RakeTaskImpl description="Create tag v0.1.0 and build and push laftel-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
|
39
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
|
40
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
|
41
|
+
<RakeTaskImpl id="release">
|
|
42
|
+
<subtasks>
|
|
43
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
|
44
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
|
45
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
|
46
|
+
</subtasks>
|
|
47
|
+
</RakeTaskImpl>
|
|
48
|
+
</subtasks>
|
|
49
|
+
</RakeTaskImpl>
|
|
50
|
+
</option>
|
|
51
|
+
</component>
|
|
52
|
+
</module>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/vcs.xml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
laftel (0.1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
httparty (0.21.0)
|
|
10
|
+
mini_mime (>= 1.0.0)
|
|
11
|
+
multi_xml (>= 0.5.2)
|
|
12
|
+
mini_mime (1.1.5)
|
|
13
|
+
multi_xml (0.6.0)
|
|
14
|
+
rake (13.0.6)
|
|
15
|
+
|
|
16
|
+
PLATFORMS
|
|
17
|
+
arm64-darwin-22
|
|
18
|
+
|
|
19
|
+
DEPENDENCIES
|
|
20
|
+
httparty
|
|
21
|
+
laftel!
|
|
22
|
+
rake (~> 13.0)
|
|
23
|
+
|
|
24
|
+
BUNDLED WITH
|
|
25
|
+
2.4.10
|
data/README.md
ADDED
data/Rakefile
ADDED
data/laftel.gemspec
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/laftel/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "laftel"
|
|
7
|
+
spec.version = Laftel::VERSION
|
|
8
|
+
spec.authors = ["dya_only"]
|
|
9
|
+
spec.email = ["dyacode@proton.me"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Unofficial Laftel API Wrapper for Ruby"
|
|
12
|
+
spec.description = "Unofficial Laftel API Wrapper for Ruby"
|
|
13
|
+
spec.homepage = "https://dyacode.kro.kr"
|
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
|
15
|
+
|
|
16
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
|
17
|
+
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/dya-only"
|
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/dya-only"
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
+
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
spec.bindir = "exe"
|
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
32
|
+
spec.require_paths = ["lib"]
|
|
33
|
+
|
|
34
|
+
# Uncomment to register a new dependency of your gem
|
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
|
36
|
+
|
|
37
|
+
# For more information and examples about making a new gem, check out our
|
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
|
39
|
+
end
|
data/lib/laftel.rb
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "laftel/version"
|
|
4
|
+
require 'httparty'
|
|
5
|
+
|
|
6
|
+
module Laftel
|
|
7
|
+
@base_url = 'https://laftel.net/api'
|
|
8
|
+
|
|
9
|
+
class Error < StandardError; end
|
|
10
|
+
|
|
11
|
+
extend self
|
|
12
|
+
|
|
13
|
+
def search(keyword = '')
|
|
14
|
+
uri = @base_url + '/search/v3/keyword'
|
|
15
|
+
|
|
16
|
+
if keyword.class.name != 'String'
|
|
17
|
+
return { success: false, message: 'keyword의 타입이 일치하지 않아요.' }
|
|
18
|
+
end
|
|
19
|
+
if keyword.length < 1
|
|
20
|
+
return { success: false, message: 'keyword가 형식에 맞지 않아요.' }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
res = HTTParty.get(uri, :query => { 'keyword': keyword }, :headers => { 'laftel': 'TeJava' })
|
|
24
|
+
return { success: true, result: JSON.parse(res.body) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_item(id = '')
|
|
28
|
+
uri = @base_url + '/items/v2/'
|
|
29
|
+
|
|
30
|
+
if id.class.name != 'String'
|
|
31
|
+
return { success: false, message: 'id의 타입이 일치하지 않아요.' }
|
|
32
|
+
end
|
|
33
|
+
if id.length < 1
|
|
34
|
+
return { success: false, message: 'id가 형식에 맞지 않아요.' }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
res = HTTParty.get(uri + id, :headers => { 'laftel': 'TeJava' })
|
|
38
|
+
return { success: true, result: JSON.parse(res.body) }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def get_episode(id = '')
|
|
42
|
+
uri = @base_url + '/episodes/v2/list'
|
|
43
|
+
|
|
44
|
+
if id.class.name != 'String'
|
|
45
|
+
return { success: false, message: 'id의 타입이 일치하지 않아요.' }
|
|
46
|
+
end
|
|
47
|
+
if id.length < 1
|
|
48
|
+
return { success: false, message: 'id가 형식에 맞지 않아요.' }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
res = HTTParty.get(uri, :query => { 'item_id': id }, :headers => { 'laftel': 'TeJava' })
|
|
52
|
+
return { success: true, result: JSON.parse(res.body) }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def discover
|
|
56
|
+
uri = @base_url + '/search/v1/discover'
|
|
57
|
+
|
|
58
|
+
res = HTTParty.get(uri, :query => { 'sort': 'rank', 'offset': 0, 'size': 60 })
|
|
59
|
+
return { success: true, result: JSON.parse(res.body) }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def auto_complete(keyword = '')
|
|
63
|
+
uri = @base_url + '/search/v1/auto_complete'
|
|
64
|
+
|
|
65
|
+
if keyword.class.name != 'String'
|
|
66
|
+
return { success: false, message: 'keyword의 타입이 일치하지 않아요.' }
|
|
67
|
+
end
|
|
68
|
+
if keyword.length < 1
|
|
69
|
+
return { success: false, message: 'keyword가 형식에 맞지 않아요.' }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
res = HTTParty.get(uri, :query => { 'keyword': keyword }, :headers => { 'laftel': 'TeJava' })
|
|
73
|
+
return { success: true, result: JSON.parse(res.body) }
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def ranking(type = '') # 4hour, week, quarter, history
|
|
77
|
+
uri = @base_url + '/home/v1/recommend/ranking'
|
|
78
|
+
|
|
79
|
+
res = HTTParty.get(uri, :query => { 'type': type }, :headers => { 'laftel': 'TeJava' })
|
|
80
|
+
return { success: true, result: JSON.parse(res.body) }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def hot
|
|
84
|
+
uri = @base_url + '/items/v1/hot'
|
|
85
|
+
|
|
86
|
+
res = HTTParty.get(uri, :headers => { 'laftel': 'TeJava' })
|
|
87
|
+
return { success: true, return: JSON.parse(res.body) }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def daily
|
|
91
|
+
uri = @base_url + '/search/v2/daily'
|
|
92
|
+
|
|
93
|
+
res = HTTParty.get(uri, :headers => { 'laftel': 'TeJava' })
|
|
94
|
+
return { success: true, return: JSON.parse(res.body) }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def carousels
|
|
98
|
+
uri = @base_url + '/carousels/v1/list'
|
|
99
|
+
|
|
100
|
+
res = HTTParty.get(uri, :headers => { 'laftel': 'TeJava' })
|
|
101
|
+
return { success: true, return: JSON.parse(res.body) }
|
|
102
|
+
end
|
|
103
|
+
end
|
data/sig/laftel.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: laftel
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- dya_only
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2023-09-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Unofficial Laftel API Wrapper for Ruby
|
|
14
|
+
email:
|
|
15
|
+
- dyacode@proton.me
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".idea/.gitignore"
|
|
21
|
+
- ".idea/discord.xml"
|
|
22
|
+
- ".idea/laftel.iml"
|
|
23
|
+
- ".idea/misc.xml"
|
|
24
|
+
- ".idea/modules.xml"
|
|
25
|
+
- ".idea/vcs.xml"
|
|
26
|
+
- Gemfile
|
|
27
|
+
- Gemfile.lock
|
|
28
|
+
- README.md
|
|
29
|
+
- Rakefile
|
|
30
|
+
- laftel.gemspec
|
|
31
|
+
- lib/laftel.rb
|
|
32
|
+
- lib/laftel/version.rb
|
|
33
|
+
- sig/laftel.rbs
|
|
34
|
+
homepage: https://dyacode.kro.kr
|
|
35
|
+
licenses: []
|
|
36
|
+
metadata:
|
|
37
|
+
homepage_uri: https://dyacode.kro.kr
|
|
38
|
+
source_code_uri: https://github.com/dya-only
|
|
39
|
+
changelog_uri: https://github.com/dya-only
|
|
40
|
+
post_install_message:
|
|
41
|
+
rdoc_options: []
|
|
42
|
+
require_paths:
|
|
43
|
+
- lib
|
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: 2.6.0
|
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
requirements: []
|
|
55
|
+
rubygems_version: 3.4.10
|
|
56
|
+
signing_key:
|
|
57
|
+
specification_version: 4
|
|
58
|
+
summary: Unofficial Laftel API Wrapper for Ruby
|
|
59
|
+
test_files: []
|