Class: LiffService
- Inherits:
-
Object
- Object
- LiffService
- Defined in:
- lib/kamiliff/services/liff_service.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
liff id.
-
#path ⇒ Object
rails routes path.
-
#size ⇒ Object
size COMPACT TALL FULL.
-
#url ⇒ Object
liff app url liff.line.me/app/#liff_id.
Instance Method Summary collapse
- #full_url ⇒ Object
-
#initialize(options) ⇒ LiffService
constructor
A new instance of LiffService.
Constructor Details
#initialize(options) ⇒ LiffService
Returns a new instance of LiffService.
17 18 19 20 21 22 23 24 25 |
# File 'lib/kamiliff/services/liff_service.rb', line 17 def initialize() self.path = [:path] || "/" self.size = [:liff_size] || :compact self.size = size.to_s.upcase raise "liff_size should be compact, tall or full." unless size.in? %w[COMPACT TALL FULL] self.url = ENV["LIFF_#{size}"] raise "LIFF_#{size} should be in the env variables" if url.blank? self.id = url[(url.rindex('/')+1)..-1] end |
Instance Attribute Details
#id ⇒ Object
liff id
15 16 17 |
# File 'lib/kamiliff/services/liff_service.rb', line 15 def id @id end |
#path ⇒ Object
rails routes path
4 5 6 |
# File 'lib/kamiliff/services/liff_service.rb', line 4 def path @path end |
#size ⇒ Object
size COMPACT TALL FULL
8 9 10 |
# File 'lib/kamiliff/services/liff_service.rb', line 8 def size @size end |
#url ⇒ Object
liff app url liff.line.me/app/#liff_id
12 13 14 |
# File 'lib/kamiliff/services/liff_service.rb', line 12 def url @url end |
Instance Method Details
#full_url ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/kamiliff/services/liff_service.rb', line 27 def full_url # liff mode is Concatenate base64_string = Base64EncodeService.new({ path: path, liff_size: size }).run "#{url}/#{base64_string}" end |