Class: FiveMobilePush::Client
- Inherits:
-
Object
- Object
- FiveMobilePush::Client
- Defined in:
- lib/five_mobile_push/client.rb
Constant Summary
- DEFAULT_ENDPOINT =
'https://push.fivemobile.com/rest/'
Instance Attribute Summary (collapse)
-
- (Object) adapter
Returns the value of attribute adapter.
-
- (Object) api_token
Returns the value of attribute api_token.
-
- (Object) application_uid
Returns the value of attribute application_uid.
Instance Method Summary (collapse)
- - (Object) connection
- - (Object) device(device_uid)
- - (Object) get(path, options = {})
-
- (Client) initialize(options = {})
constructor
A new instance of Client.
- - (Object) notifier
- - (Object) post(path, options = {})
- - (Object) tag(device_uid)
Constructor Details
- (Client) initialize(options = {})
A new instance of Client
10 11 12 13 14 |
# File 'lib/five_mobile_push/client.rb', line 10 def initialize(={}) self.application_uid = [:application_uid] || FiveMobilePush.application_uid self.api_token = [:api_token] || FiveMobilePush.api_token self.adapter = [:adapter] || FiveMobilePush.adapter end |
Instance Attribute Details
- (Object) adapter
Returns the value of attribute adapter
8 9 10 |
# File 'lib/five_mobile_push/client.rb', line 8 def adapter @adapter end |
- (Object) api_token
Returns the value of attribute api_token
8 9 10 |
# File 'lib/five_mobile_push/client.rb', line 8 def api_token @api_token end |
- (Object) application_uid
Returns the value of attribute application_uid
8 9 10 |
# File 'lib/five_mobile_push/client.rb', line 8 def application_uid @application_uid end |
Instance Method Details
- (Object) connection
17 18 19 20 21 22 |
# File 'lib/five_mobile_push/client.rb', line 17 def connection @connection ||= Faraday.new(:url => DEFAULT_ENDPOINT, :user_agent => 'FiveMobilePush Ruby gem') do |builder| builder.adapter self.adapter builder.use Faraday::Response::Errors end end |
- (Object) device(device_uid)
32 33 34 |
# File 'lib/five_mobile_push/client.rb', line 32 def device(device_uid) FiveMobilePush::Device.new(self, device_uid) end |
- (Object) get(path, options = {})
24 25 26 |
# File 'lib/five_mobile_push/client.rb', line 24 def get(path, ={}) perform_request(:get, path, ) end |
- (Object) notifier
36 37 38 |
# File 'lib/five_mobile_push/client.rb', line 36 def notifier FiveMobilePush::Notifier.new(self) end |
- (Object) post(path, options = {})
28 29 30 |
# File 'lib/five_mobile_push/client.rb', line 28 def post(path, ={}) perform_request(:post, path, ) end |
- (Object) tag(device_uid)
40 41 42 |
# File 'lib/five_mobile_push/client.rb', line 40 def tag(device_uid) FiveMobilePush::Tag.new(self, device_uid) end |