liff_selector 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a22069d7fa911f369e4ad6c2c26a090d6f5b557
4
- data.tar.gz: 672c0d48ce2b02a35e4c485fa033a4eb929d2fb9
3
+ metadata.gz: 9ff3d5d998f5079fa7d3168b6ac976c28f12e0e1
4
+ data.tar.gz: 79c08d27169bffa7848335286088d1ad9d30b53e
5
5
  SHA512:
6
- metadata.gz: e57d52d05706084b65b809aa9dbdaa09c9d9c8b131bade7132d209f7a8f7a778badecf44c5d872b07b48e5b61abfb5ad92d563eed043b8dffb2ed390a2390bd0
7
- data.tar.gz: 5a9ab3999301df8aa9e0f28490b3d2748f47def4322e6882ff2ffb22b4200cd1ee4a27d891561d042f8ea0118e58b54923e69918653915322828a0c1ee35af66
6
+ metadata.gz: be593e75dddf4bc34b94a846692f81823a3527271182b8afacb62dcc3ee3b60e0b2758881c19d8c9a154dae5be3e39a5e09f40fa5581d31596f419d9e68875f3
7
+ data.tar.gz: 3aab652eae70d833607af02b68211c9d6cb31dcc597d97253f60b044ca110a569157e7a8ffb7a0fe0c308438e968ca674c7421eb4a02a87420ff1bfc925d2ca6
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ liff_selector (0.2.0)
5
+ dotenv
6
+ rest-client
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.3)
12
+ domain_name (0.5.20180417)
13
+ unf (>= 0.0.5, < 1.0.0)
14
+ dotenv (2.4.0)
15
+ http-cookie (1.0.3)
16
+ domain_name (~> 0.5)
17
+ mime-types (3.1)
18
+ mime-types-data (~> 3.2015)
19
+ mime-types-data (3.2016.0521)
20
+ netrc (0.11.0)
21
+ rake (10.5.0)
22
+ rest-client (2.0.2)
23
+ http-cookie (>= 1.0.2, < 2.0)
24
+ mime-types (>= 1.16, < 4.0)
25
+ netrc (~> 0.8)
26
+ rspec (3.7.0)
27
+ rspec-core (~> 3.7.0)
28
+ rspec-expectations (~> 3.7.0)
29
+ rspec-mocks (~> 3.7.0)
30
+ rspec-core (3.7.1)
31
+ rspec-support (~> 3.7.0)
32
+ rspec-expectations (3.7.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.7.0)
35
+ rspec-mocks (3.7.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.7.0)
38
+ rspec-support (3.7.1)
39
+ unf (0.1.4)
40
+ unf_ext
41
+ unf_ext (0.0.7.5)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ bundler (~> 1.16)
48
+ dotenv
49
+ liff_selector!
50
+ rake (~> 10.0)
51
+ rest-client
52
+ rspec (~> 3.0)
53
+
54
+ BUNDLED WITH
55
+ 1.16.0
data/README.md CHANGED
@@ -93,15 +93,6 @@ $ bundle exec liff_select clean
93
93
  > [SUCESS] delete app
94
94
  ```
95
95
 
96
- ### document
97
- display reference url
98
-
99
- ```
100
- $ bundle exec liff_select document
101
- document url : https://developers.line.me/ja/docs/liff/reference
102
- ```
103
-
104
-
105
96
  ## License
106
97
 
107
98
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,43 @@
1
+ <html>
2
+ <head>
3
+ <title>sample application</title>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
5
+ </head>
6
+
7
+ <body>
8
+ <script src="https://d.line-scdn.net/liff/1.0/sdk.js"></script>
9
+ <div id='user_name'>Name : XXXX</div>
10
+ <img id='user_photo' src="" />
11
+ <button onclick='clicked()'>send_message</button>
12
+ <script>
13
+ liff.init(
14
+ data => {
15
+ // Now you can call LIFF API
16
+ const userId = data.context.userId;
17
+ liff.getProfile()
18
+ .then(profile => {
19
+ document.getElementById('user_name').innerText = 'Name : ' + profile.displayName;
20
+ const name = profile.displayName
21
+ document.getElementById('user_photo').src = profile.pictureUrl;
22
+ })
23
+ .catch((err) => {
24
+ console.log('error', err);
25
+ });
26
+
27
+ },
28
+ err => {
29
+ // LIFF initialization failed
30
+ }
31
+ );
32
+ clicked = function(){
33
+ liff.sendMessages([
34
+ {
35
+ type:'text',
36
+ text:'Hello, World!'
37
+ }
38
+ ])
39
+ }
40
+ </script>
41
+ </body>
42
+
43
+ </html>
data/lib/liff_selector.rb CHANGED
@@ -11,16 +11,19 @@ module LiffSelector
11
11
  show
12
12
  when 'same'
13
13
  same
14
- when 'create'
14
+ when 'upload'
15
15
  raise ArgumentError, 'give _type_ _url_' if argv.length != 3
16
- create(type: argv[1], url: argv[2])
16
+ upload(type: argv[1], url: argv[2])
17
17
  when 'clean'
18
18
  clean
19
19
  when 'delete'
20
20
  raise ArgumentError, 'give _liff_id_' if argv.length != 2
21
21
  delete(liff_id: argv[1])
22
- when 'document'
23
- puts 'document url : https://developers.line.me/ja/docs/liff/reference'
22
+ when 'help'
23
+ help
24
+ when 'create'
25
+ raise ArgumentError, 'give _file_name_' if argv.length != 2
26
+ create(file_name: argv[1])
24
27
  else
25
28
  raise NotImplementedError, 'unknow command given'
26
29
  end
@@ -49,7 +52,13 @@ module LiffSelector
49
52
  }.flatten!
50
53
  end
51
54
 
52
- def self.create(type:, url:)
55
+ def self.create(file_name:)
56
+ sample = File.read('./assets/sample.html')
57
+ File.write("#{file_name}.html", sample)
58
+ puts "> make ./#{file_name}.html"
59
+ end
60
+
61
+ def self.upload(type:, url:)
53
62
  raise ArgumentError, 'not correct uri' unless correct_url?(url)
54
63
  raise ArgumentError, 'not correct type please choose [compact, tall, full]' unless ["compact", "tall", "full"].include?(type)
55
64
  puts '> make liff app'
@@ -79,6 +88,21 @@ module LiffSelector
79
88
  end
80
89
  end
81
90
 
91
+ def self.help
92
+ help =
93
+ <<'EOS'
94
+ liff_select show : display all apps
95
+ liff_select same : display same url and type apps
96
+ liff_select clean : delete same url and type apps
97
+ liff_select upload _TYPE_ _URL_ : upload new apps with type and url.
98
+ : type is <type:compact|tall:|full>
99
+ liff_select delete _LIFF_ID_ : delete app _LIFF_ID_ is referenced show number.
100
+ liff_select help : liff_select helps
101
+ liff_select new _html_name_ : make liff sample html
102
+ EOS
103
+ puts help
104
+ end
105
+
82
106
  def self.delete(liff_id:)
83
107
  app = all_apps[liff_id.to_i-1]
84
108
  puts "#{liff_id}. #{app['liffId']}\t#{app['view']['type']}\t#{app['view']['url']}"
@@ -1,3 +1,3 @@
1
1
  module LiffSelector
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liff_selector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 4geru
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -91,9 +91,11 @@ files:
91
91
  - ".gitignore"
92
92
  - CODE_OF_CONDUCT.md
93
93
  - Gemfile
94
+ - Gemfile.lock
94
95
  - LICENSE.txt
95
96
  - README.md
96
97
  - Rakefile
98
+ - assets/sample.html
97
99
  - bin/console
98
100
  - bin/setup
99
101
  - exe/liff_select