Class: Baidu::Push::API
- Inherits:
-
Object
- Object
- Baidu::Push::API
- Defined in:
- lib/baidu/push/api.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #base_path ⇒ Object
- #default_domain ⇒ Object
-
#initialize(options = {}) ⇒ API
constructor
A new instance of API.
Constructor Details
#initialize(options = {}) ⇒ API
Returns a new instance of API.
8 9 10 11 12 13 14 15 |
# File 'lib/baidu/push/api.rb', line 8 def initialize( = {}) @connection = Faraday.new(url: default_domain) do |faraday| faraday.request :multipart faraday.request :url_encoded faraday.response :logger, [:logger] if [:logger] faraday.adapter Faraday.default_adapter end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/baidu/push/api.rb', line 6 def connection @connection end |
Instance Method Details
#base_path ⇒ Object
17 18 19 |
# File 'lib/baidu/push/api.rb', line 17 def base_path '/rest/2.0/channel' end |
#default_domain ⇒ Object
21 22 23 |
# File 'lib/baidu/push/api.rb', line 21 def default_domain 'https://channel.api.duapp.com' end |