Class: Line::Bot::LiffClient
Constant Summary collapse
- @@api_version =
"v1"
Class Method Summary collapse
- .create_by_line_bot_client(line_bot_client) ⇒ Object
-
.default_endpoint ⇒ Object
def self.api_version @@api_version end.
Instance Method Summary collapse
- #create_liff(type, url, description = nil, features = {}) ⇒ Object
- #delete_liff(liff_id) ⇒ Object
- #endpoint ⇒ Object
- #get_liffs ⇒ Object
- #update_liff(liff_id, type = nil, url = nil, description = nil, features = {}) ⇒ Object
Methods inherited from Client
Class Method Details
.create_by_line_bot_client(line_bot_client) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/line_liff.rb', line 56 def self.create_by_line_bot_client line_bot_client self.new{|config| config.channel_secret = line_bot_client.channel_secret config.channel_token = line_bot_client.channel_token } end |
.default_endpoint ⇒ Object
def self.api_version
@@api_version
end
65 66 67 |
# File 'lib/line_liff.rb', line 65 def self.default_endpoint "https://api.line.me/liff/#{@@api_version}/apps" end |
Instance Method Details
#create_liff(type, url, description = nil, features = {}) ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/line_liff.rb', line 76 def create_liff type,url,description = nil,features = {} payload = { view:{ type:type,url:url }, description:description, features:features } post "", payload.to_json end |
#delete_liff(liff_id) ⇒ Object
95 96 97 |
# File 'lib/line_liff.rb', line 95 def delete_liff liff_id delete "/#{liff_id}" end |
#endpoint ⇒ Object
68 69 70 |
# File 'lib/line_liff.rb', line 68 def endpoint @endpoint ||= self.class.default_endpoint end |
#get_liffs ⇒ Object
71 72 73 74 |
# File 'lib/line_liff.rb', line 71 def get_liffs endpoint_path = "" get endpoint_path end |
#update_liff(liff_id, type = nil, url = nil, description = nil, features = {}) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/line_liff.rb', line 86 def update_liff liff_id,type=nil,url=nil,description = nil,features = {} payload = {} payload[:view] = {type:type,url:url}.reject { |k,v| v.nil? } payload[:descriptions] = description payload[:features] = features payload.reject!{|k,v| v.nil? or v.length == 0} put "/#{liff_id}", payload.to_json end |