Class: Line::Bot::Client
- Inherits:
-
Object
- Object
- Line::Bot::Client
- Defined in:
- lib/line/bot/client.rb
Instance Attribute Summary collapse
-
#certentials ⇒ Object
Returns the value of attribute certentials.
Instance Method Summary collapse
-
#initialize(options = {}) {|_self| ... } ⇒ Client
constructor
A new instance of Client.
- #send_message(to_mid, message) ⇒ Object
- #send_text(to_mid, message) ⇒ Object
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 |
# File 'lib/line/bot/client.rb', line 6 def initialize( = {}) @certentials = if .is_a?(Certentials) @certentials = Certentials.new() if .is_a?(Hash) yield(self) if block_given? end |
Instance Attribute Details
#certentials ⇒ Object
Returns the value of attribute certentials.
4 5 6 |
# File 'lib/line/bot/client.rb', line 4 def certentials @certentials end |
Instance Method Details
#send_message(to_mid, message) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/line/bot/client.rb', line 16 def (to_mid, ) request = Request.new do |config| config.to_mid = to_mid config.certentials = @certentials config.endpoint = API::ENDPOINT config.endpoint_path = "/events" config. = config.event_type = Line::Bot::EventType::MESSAGE end request.post end |
#send_text(to_mid, message) ⇒ Object
12 13 14 |
# File 'lib/line/bot/client.rb', line 12 def send_text(to_mid, ) (to_mid, Message::Text.new(text: )) end |