Module: Kamigo
- Defined in:
- lib/kamigo.rb,
lib/kamigo/engine.rb,
lib/kamigo/railtie.rb,
lib/kamigo/version.rb,
lib/kamigo/line_account.rb,
lib/kamigo/events/line_event.rb,
lib/kamigo/events/basic_event.rb,
lib/kamigo/clients/line_client.rb,
lib/generators/kamigo/install_generator.rb,
lib/kamigo/event_parsers/line_event_parser.rb,
lib/kamigo/event_responsers/line_event_responser.rb,
lib/kamigo/request_handlers/line_request_handler.rb,
lib/kamigo/event_processors/default_path_processor.rb,
lib/kamigo/event_processors/rails_router_processor.rb,
lib/kamigo/event_processors/default_message_processor.rb
Defined Under Namespace
Modules: Clients, EventParsers, EventProcessors, EventResponsers, Events, Generators, RequestHandlers
Classes: Engine, LineAccount, Railtie
Constant Summary
collapse
- VERSION =
'0.36.0'.freeze
- @@line_default_message =
{
type: "text",
text: "Sorry, I don't understand your message."
}
- @@default_path =
nil
- @@default_http_method =
"GET"
- @@line_event_processors =
[
EventProcessors::RailsRouterProcessor.new,
EventProcessors::DefaultPathProcessor.new,
EventProcessors::DefaultMessageProcessor.new
]
- @@line_messaging_api_channel_id =
- @@line_messaging_api_channel_secret =
- @@line_messaging_api_channel_token =
- @@line_accounts =
{}
Class Method Summary
collapse
Class Method Details
.default_account ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/kamigo.rb', line 74
def self.default_account
return @@line_accounts.values.first if @@line_accounts.any?
account = LineAccount.new("default")
account.channel_id = line_messaging_api_channel_id
account.channel_secret = line_messaging_api_channel_secret
account.channel_token = line_messaging_api_channel_token
account.default_path = default_path
account.default_http_method = default_http_method
account
end
|
.find_account(name) ⇒ Object
69
70
71
72
|
# File 'lib/kamigo.rb', line 69
def self.find_account(name)
return default_account if name.blank?
@@line_accounts[name.to_s] || default_account
end
|
.line_account(name) {|account| ... } ⇒ Object
63
64
65
66
67
|
# File 'lib/kamigo.rb', line 63
def self.line_account(name)
account = LineAccount.new(name)
yield account
@@line_accounts[name.to_s] = account
end
|
.setup {|_self| ... } ⇒ Object
59
60
61
|
# File 'lib/kamigo.rb', line 59
def self.setup
yield self
end
|