Skip to content

Commit 9c7c73f

Browse files
authored
Merge pull request #174 from koheisg/quit-top-level
Quit top level reference
2 parents 2aa724d + b656549 commit 9c7c73f

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

lib/line/bot/api.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module API
2222

2323
DEFAULT_HEADERS = {
2424
'Content-Type' => 'application/json; charset=UTF-8',
25-
'User-Agent' => "LINE-BotSDK-Ruby/#{Line::Bot::API::VERSION}"
25+
'User-Agent' => "LINE-BotSDK-Ruby/#{VERSION}"
2626
}.freeze
2727
end
2828
end

lib/line/bot/client.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ def initialize(options = {})
4848
end
4949

5050
def httpclient
51-
@httpclient ||= Line::Bot::HTTPClient.new(http_options)
51+
@httpclient ||= HTTPClient.new(http_options)
5252
end
5353

5454
def endpoint
55-
@endpoint ||= Line::Bot::API::DEFAULT_ENDPOINT
55+
@endpoint ||= API::DEFAULT_ENDPOINT
5656
end
5757

5858
def blob_endpoint
5959
return @blob_endpoint if @blob_endpoint
6060

61-
@blob_endpoint = if endpoint == Line::Bot::API::DEFAULT_ENDPOINT
62-
Line::Bot::API::DEFAULT_BLOB_ENDPOINT
61+
@blob_endpoint = if endpoint == API::DEFAULT_ENDPOINT
62+
API::DEFAULT_BLOB_ENDPOINT
6363
else
6464
# for backward compatible
6565
endpoint
@@ -598,7 +598,7 @@ def get_friend_demographics
598598
#
599599
# @return [Net::HTTPResponse]
600600
def get(endpoint_base, endpoint_path, headers = {})
601-
headers = Line::Bot::API::DEFAULT_HEADERS.merge(headers)
601+
headers = API::DEFAULT_HEADERS.merge(headers)
602602
httpclient.get(endpoint_base + endpoint_path, headers)
603603
end
604604

@@ -611,7 +611,7 @@ def get(endpoint_base, endpoint_path, headers = {})
611611
#
612612
# @return [Net::HTTPResponse]
613613
def post(endpoint_base, endpoint_path, payload = nil, headers = {})
614-
headers = Line::Bot::API::DEFAULT_HEADERS.merge(headers)
614+
headers = API::DEFAULT_HEADERS.merge(headers)
615615
httpclient.post(endpoint_base + endpoint_path, payload, headers)
616616
end
617617

@@ -623,7 +623,7 @@ def post(endpoint_base, endpoint_path, payload = nil, headers = {})
623623
#
624624
# @return [Net::HTTPResponse]
625625
def delete(endpoint_base, endpoint_path, headers = {})
626-
headers = Line::Bot::API::DEFAULT_HEADERS.merge(headers)
626+
headers = API::DEFAULT_HEADERS.merge(headers)
627627
httpclient.delete(endpoint_base + endpoint_path, headers)
628628
end
629629

@@ -637,10 +637,10 @@ def parse_events_from(request_body)
637637

638638
json['events'].map do |item|
639639
begin
640-
klass = Line::Bot::Event.const_get(Line::Bot::Util.camelize(item['type']))
640+
klass = Event.const_get(Util.camelize(item['type']))
641641
klass.new(item)
642642
rescue NameError
643-
Line::Bot::Event::Base.new(item)
643+
Event::Base.new(item)
644644
end
645645
end
646646
end

lib/line/bot/event/message.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ module MessageType
3131
# https://developers.line.biz/en/reference/messaging-api/#message-event
3232
class Message < Base
3333
def type
34-
Line::Bot::Event::MessageType.const_get(@src['message']['type'].capitalize)
34+
MessageType.const_get(@src['message']['type'].capitalize)
3535
rescue NameError => e
36-
Line::Bot::Event::MessageType::Unsupport
36+
MessageType::Unsupport
3737
end
3838

3939
def message

lib/line/bot/event/things.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module ThingsType
2929
# * https://developers.line.biz/en/reference/messaging-api/#scenario-result-event
3030
class Things < Base
3131
def type
32-
Line::Bot::Event::ThingsType.const_get(Line::Bot::Util.camelize(@src['things']['type']))
32+
ThingsType.const_get(Util.camelize(@src['things']['type']))
3333
rescue NameError
34-
Line::Bot::Event::ThingsType::Unsupport
34+
ThingsType::Unsupport
3535
end
3636

3737
def device_id

0 commit comments

Comments
 (0)