File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ class Client
27
27
# @return [Object]
28
28
attr_accessor :httpclient
29
29
30
+ # @return [Hash]
31
+ attr_accessor :http_options
32
+
30
33
# Initialize a new Bot Client.
31
34
#
32
35
# @param options [Hash]
@@ -40,7 +43,7 @@ def initialize(options = {})
40
43
end
41
44
42
45
def httpclient
43
- @httpclient ||= Line ::Bot ::HTTPClient . new
46
+ @httpclient ||= Line ::Bot ::HTTPClient . new ( http_options )
44
47
end
45
48
46
49
def endpoint
Original file line number Diff line number Diff line change 20
20
module Line
21
21
module Bot
22
22
class HTTPClient
23
+ # @return [Hash]
24
+ attr_accessor :http_options
25
+
26
+ # Initialize a new HTTPClient
27
+ #
28
+ # @param http_options [Hash]
29
+ #
30
+ # @return [Line::Bot::HTTPClient]
31
+ def initialize ( http_options = { } )
32
+ @http_options = http_options
33
+ end
34
+
23
35
# @return [Net::HTTP]
24
36
def http ( uri )
25
37
http = Net ::HTTP . new ( uri . host , uri . port )
26
38
if uri . scheme == "https"
27
39
http . use_ssl = true
28
40
end
29
41
42
+ if http_options
43
+ http_options . each do |key , value |
44
+ http . send ( "#{ key } =" , value )
45
+ end
46
+ end
47
+
30
48
http
31
49
end
32
50
You can’t perform that action at this time.
0 commit comments