Class: UserLocalChatApi::Client
- Inherits:
-
Object
- Object
- UserLocalChatApi::Client
- Defined in:
- lib/user_local_chat_api.rb
Constant Summary collapse
- DEFAULT_URL =
'https://chatbot-api.userlocal.jp/api'
Instance Method Summary collapse
- #character(msg, character_type = nil) ⇒ Object
- #chat(msg, user_name = nil) ⇒ Object
- #decompose(text, detail = false, cut_last_word = false) ⇒ Object
-
#initialize(access_token = nil) ⇒ Client
constructor
A new instance of Client.
- #name(name) ⇒ Object
Constructor Details
#initialize(access_token = nil) ⇒ Client
Returns a new instance of Client.
10 11 12 |
# File 'lib/user_local_chat_api.rb', line 10 def initialize(access_token = nil) @access_token = access_token || ENV['USER_LOCAL_ACCESS_TOKEN'] end |
Instance Method Details
#character(msg, character_type = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/user_local_chat_api.rb', line 22 def character(msg, character_type = nil) params = { message: msg, character_type: character_type, } response("character", params) end |
#chat(msg, user_name = nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/user_local_chat_api.rb', line 14 def chat(msg, user_name = nil) params = { message: msg, user_name: user_name, } response("chat", params) end |
#decompose(text, detail = false, cut_last_word = false) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/user_local_chat_api.rb', line 35 def decompose(text, detail = false, cut_last_word = false) params = { message: text, detail: detail, cut_last_word: cut_last_word, } response("decompose", params) end |
#name(name) ⇒ Object
30 31 32 33 |
# File 'lib/user_local_chat_api.rb', line 30 def name(name) params = { message: name } response("name", params) end |