Class: Line::Bot::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/line_liff.rb

Direct Known Subclasses

LiffClient

Instance Method Summary collapse

Instance Method Details

#put(endpoint_path, payload = nil, headers = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/line_liff.rb', line 34

def put(endpoint_path, payload = nil,headers={})
  if defined?(Line::Bot::Request)
    if self.class.method_defined? :credentials?
      raise Line::Bot::API::InvalidCredentialsError, 'Invalidates credentials' unless credentials?
    else
      channel_token_required
    end
    request = Line::Bot::Request.new do |config|
      config.httpclient     = httpclient
      config.endpoint       = endpoint
      config.endpoint_path  = endpoint_path
      config.credentials    = credentials
      config.payload        = payload if payload
    end
      
    return request.put
  else
    headers = Line::Bot::API::DEFAULT_HEADERS.merge(headers)
    httpclient.put(endpoint + endpoint_path, payload, headers)
  end
end