line_liff 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/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/line_liff/version.rb +3 -0
- data/lib/line_liff.rb +100 -0
- data/line_liff.gemspec +32 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 921867960d5f6ce32e2ba48f39ee10ba3abf05078522139d406adc197bb95540
|
4
|
+
data.tar.gz: dd4388fea9af4e046e289603ecb8859bda933657e46756013dc04b115548af98
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24f9d53c66c5c9e7666f55bc5ab89433cee8e894777ca5ae4d6758e378ee4562f79b60fd444f25e575a383a68dee9d30471028f6ca29dd51b0851365f5a6dbd3
|
7
|
+
data.tar.gz: c5e3984abcfc3393da6c619e74decc9d4507b01ee53eba4e69c05855cf7639eb54a0fd8db93306cf86ca4d95c022288ccf4d9ee8270eb59887306df9927dfad4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 mosle
|
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,64 @@
|
|
1
|
+
# LineLiff
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/line_liff`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'line_liff'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install line_liff
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
see https://developers.line.biz/ja/reference/liff/
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
liff_client = Line::Bot::LiffClient.new{|config|
|
29
|
+
config.channel_token = "your channel token"
|
30
|
+
}
|
31
|
+
response = liff_client.get_liffs #https://developers.line.biz/ja/reference/liff/#get-all-liff-apps
|
32
|
+
|
33
|
+
response = liff_client.create_liff "compact","https://url-of-liff-app","any-description"
|
34
|
+
#https://developers.line.biz/ja/reference/liff/#add-liff-app
|
35
|
+
|
36
|
+
response = liff_client.delete_liff "id-of-any-liff"
|
37
|
+
#https://developers.line.biz/ja/reference/liff/#delete-liff-app
|
38
|
+
|
39
|
+
|
40
|
+
response = liff_client.update_liff "id-of-any-liff","compact","https://url-of-liff-app","any-description"
|
41
|
+
#https://developers.line.biz/ja/reference/liff/#update-liff-app
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
OR
|
46
|
+
```ruby
|
47
|
+
liff_client = Line::Bot::LiffClient.create_by_line_bot_client working_line_bot_client #https://github.com/line/line-bot-sdk-ruby
|
48
|
+
|
49
|
+
#..same as listed above
|
50
|
+
|
51
|
+
```
|
52
|
+
## Development
|
53
|
+
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
55
|
+
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mosle/line_liff.
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "line_liff"
|
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
data/lib/line_liff.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
require "line-bot-api"
|
2
|
+
require "line_liff/version"
|
3
|
+
|
4
|
+
unless Line::Bot::HTTPClient.method_defined? :put
|
5
|
+
module Line
|
6
|
+
module Bot
|
7
|
+
class HTTPClient
|
8
|
+
def put(url, payload, header = {})
|
9
|
+
uri = URI(url)
|
10
|
+
http(uri).put(uri.request_uri, payload, header)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
unless Line::Bot::Request.method_defined? :put
|
18
|
+
module Line
|
19
|
+
module Bot
|
20
|
+
class Request
|
21
|
+
def put
|
22
|
+
httpclient.put(endpoint + endpoint_path, payload, header)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
unless Line::Bot::Client.method_defined? :put
|
30
|
+
module Line
|
31
|
+
module Bot
|
32
|
+
class Client
|
33
|
+
def put(endpoint_path, payload = nil)
|
34
|
+
raise Line::Bot::API::InvalidCredentialsError, 'Invalidates credentials' unless credentials?
|
35
|
+
|
36
|
+
request = Line::Bot::Request.new do |config|
|
37
|
+
config.httpclient = httpclient
|
38
|
+
config.endpoint = endpoint
|
39
|
+
config.endpoint_path = endpoint_path
|
40
|
+
config.credentials = credentials
|
41
|
+
config.payload = payload if payload
|
42
|
+
end
|
43
|
+
|
44
|
+
request.put
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
module Line
|
52
|
+
module Bot
|
53
|
+
class LiffClient < Line::Bot::Client
|
54
|
+
@@api_version = "v1"
|
55
|
+
|
56
|
+
def self.create_by_line_bot_client line_bot_client
|
57
|
+
self.new{|config|
|
58
|
+
config.channel_secret = line_bot_client.channel_secret
|
59
|
+
config.channel_token = line_bot_client.channel_token
|
60
|
+
}
|
61
|
+
end
|
62
|
+
#def self.api_version
|
63
|
+
# @@api_version
|
64
|
+
#end
|
65
|
+
def self.default_endpoint
|
66
|
+
"https://api.line.me/liff/#{@@api_version}/apps"
|
67
|
+
end
|
68
|
+
def endpoint
|
69
|
+
@endpoint ||= self.class.default_endpoint
|
70
|
+
end
|
71
|
+
def get_liffs
|
72
|
+
endpoint_path = ""
|
73
|
+
get endpoint_path
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_liff type,url,description = nil,features = {}
|
77
|
+
payload = {
|
78
|
+
view:{
|
79
|
+
type:type,url:url
|
80
|
+
},
|
81
|
+
description:description,
|
82
|
+
features:features
|
83
|
+
}
|
84
|
+
post "", payload.to_json
|
85
|
+
end
|
86
|
+
def update_liff liff_id,type=nil,url=nil,description = nil,features = {}
|
87
|
+
payload = {}
|
88
|
+
payload[:view] = {type:type,url:url}.reject { |k,v| v.nil? }
|
89
|
+
payload[:descriptions] = description
|
90
|
+
payload[:features] = features
|
91
|
+
payload.reject!{|k,v| v.nil? or v.length == 0}
|
92
|
+
put "/#{liff_id}", payload.to_json
|
93
|
+
end
|
94
|
+
|
95
|
+
def delete_liff liff_id
|
96
|
+
delete "/#{liff_id}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/line_liff.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "line_liff/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "line_liff"
|
8
|
+
spec.version = LineLiff::VERSION
|
9
|
+
spec.authors = ["mosle"]
|
10
|
+
spec.email = ["yskysd@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "line liff api gem"
|
13
|
+
spec.description = "implementation line liff api for ruby using line-bot-sdk-ruby"
|
14
|
+
spec.homepage = "https://github.com/mosle/line_liff"
|
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.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
|
28
|
+
spec.add_development_dependency "addressable", "~> 2.6"
|
29
|
+
spec.add_development_dependency "webmock", "~> 3.5.1"
|
30
|
+
|
31
|
+
spec.add_dependency "line-bot-api"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: line_liff
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mosle
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-25 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: addressable
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.5.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.5.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: line-bot-api
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: implementation line liff api for ruby using line-bot-sdk-ruby
|
98
|
+
email:
|
99
|
+
- yskysd@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- bin/console
|
112
|
+
- bin/setup
|
113
|
+
- lib/line_liff.rb
|
114
|
+
- lib/line_liff/version.rb
|
115
|
+
- line_liff.gemspec
|
116
|
+
homepage: https://github.com/mosle/line_liff
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.7.3
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: line liff api gem
|
140
|
+
test_files: []
|