Class: Pingo::Client
- Inherits:
-
Object
- Object
- Pingo::Client
- Defined in:
- lib/pingo.rb
Constant Summary collapse
- INIT_CLIENT =
'initClient'.freeze
- PLAY_SOUND =
'playSound'.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #device_ids ⇒ Object
-
#initialize(model_name) ⇒ Client
constructor
A new instance of Client.
- #sound! ⇒ Object
Constructor Details
#initialize(model_name) ⇒ Client
Returns a new instance of Client.
19 20 21 22 23 |
# File 'lib/pingo.rb', line 19 def initialize(model_name) @model_name = model_name @username = ENV['APPLE_ID'] @password = ENV['APPLE_PASSWORD'] end |
Class Method Details
.run(model_name) ⇒ Object
14 15 16 |
# File 'lib/pingo.rb', line 14 def run(model_name) new(model_name).sound! end |
Instance Method Details
#device_ids ⇒ Object
29 30 31 32 33 |
# File 'lib/pingo.rb', line 29 def device_ids response = post(INIT_CLIENT) raise "#{response.response_code}:#{response. }" unless response.success? parse_device_ids(response.body) end |
#sound! ⇒ Object
25 26 27 |
# File 'lib/pingo.rb', line 25 def sound! device_ids.each { |device_id| post(PLAY_SOUND, generate_body(device_id)) } end |