class Line::Bot::LiffClient

Public Class Methods

create_by_line_bot_client(line_bot_client) click to toggle source
# File lib/line_liff.rb, line 66
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() click to toggle source

def self.api_version

@@api_version

end

# File lib/line_liff.rb, line 75
def self.default_endpoint
  "https://api.line.me/liff/#{@@api_version}/apps"
end

Public Instance Methods

create_liff(type,url,description = nil,features = {}) click to toggle source
# File lib/line_liff.rb, line 86
def create_liff type,url,description = nil,features = {}
  payload = {
      view:{
          type:type,url:url
      },
      description:description,
      features:features
  }
  post endpoint,"", payload.to_json,credentials
end
delete_liff(liff_id) click to toggle source
# File lib/line_liff.rb, line 105
def delete_liff liff_id
  delete endpoint, "/#{liff_id}",credentials
end
endpoint() click to toggle source
# File lib/line_liff.rb, line 78
def endpoint
  @endpoint ||= self.class.default_endpoint
end
get_liffs() click to toggle source
# File lib/line_liff.rb, line 81
def get_liffs
  endpoint_path  = ""
  get endpoint,endpoint_path,credentials
end
update_liff(liff_id,type=nil,url=nil,description = nil,features = {}) click to toggle source
# File lib/line_liff.rb, line 96
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[:description] = description
  payload[:features] = features
  payload.reject!{|k,v| v.nil? or v.length == 0}
  put endpoint,"/#{liff_id}", payload.to_json,credentials
end