Class: PushWoosher::Device::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/push_woosher/device/base.rb

Direct Known Subclasses

Android, Ios

Constant Summary

Constants inherited from Base

Base::BASE_HOST, Base::BASE_PATH, Base::PROTOCOL

Instance Method Summary collapse

Methods inherited from Base

#config, #connection, #post_action

Instance Method Details

#device_typeObject

Raises:

  • (NotImplementedError)


7
8
9
# File 'lib/push_woosher/device/base.rb', line 7

def device_type
  raise NotImplementedError
end

#registerObject



26
27
28
29
30
31
# File 'lib/push_woosher/device/base.rb', line 26

def register
  post_action(
    path: 'registerDevice',
    request_hash: register_request_hash
  )
end

#register_request_hashObject



11
12
13
14
15
16
17
18
# File 'lib/push_woosher/device/base.rb', line 11

def register_request_hash
  {
    push_token: token,
    hwid: hwid,
    timezone: 0,
    device_type: device_type
  }
end

#unregisterObject



33
34
35
36
37
38
# File 'lib/push_woosher/device/base.rb', line 33

def unregister
  post_action(
    path: 'unregisterDevice',
    request_hash: unregister_request_hash
  )
end

#unregister_request_hashObject



20
21
22
23
24
# File 'lib/push_woosher/device/base.rb', line 20

def unregister_request_hash
  {
    hwid: hwid
  }
end