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) ⇒ Object
- #decompose(msg) ⇒ 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
19 20 21 22 |
# File 'lib/user_local_chat_api.rb', line 19 def character(msg, character_type = nil) url = "#{DEFAULT_URL}/character?key=#{@access_token}&message=#{msg}&character_type=#{character_type}" response(url) end |
#chat(msg) ⇒ Object
14 15 16 17 |
# File 'lib/user_local_chat_api.rb', line 14 def chat(msg) url = "#{DEFAULT_URL}/chat?key=#{@access_token}&message=#{msg}" response(url) end |
#decompose(msg) ⇒ Object
29 30 31 32 |
# File 'lib/user_local_chat_api.rb', line 29 def decompose(msg) url = "#{DEFAULT_URL}/decompose?key=#{@access_token}&message=#{msg}" response(url) end |
#name(name) ⇒ Object
24 25 26 27 |
# File 'lib/user_local_chat_api.rb', line 24 def name(name) url = "#{DEFAULT_URL}/name?key=#{@access_token}&message=#{name}" response(url) end |