Class: Pushbots::All

Inherits:
Push
  • Object
show all
Defined in:
lib/pushbots/all.rb

Overview

All class

Constant Summary

Constants inherited from Push

Push::PLATFORM_TYPE, Push::PLATFORM_TYPE_R, Push::STATUS

Instance Attribute Summary collapse

Attributes inherited from Push

#message, #platform, #response, #status, #type

Instance Method Summary collapse

Constructor Details

#initialize(platforms, message, schedule, options = {}) ⇒ All

Returns a new instance of All.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pushbots/all.rb', line 7

def initialize(platforms, message, schedule, options = {})
  super(platforms, message, :all)
  self.schedule = schedule
  self.tags = options[:tags]
  self.sound = options[:sound]
  self.badge = options[:badge]
  self.except_tags = options[:except_tags]
  self.device_alias = options[:alias]
  self.except_alias = options[:except_alias]
  self.payload = options[:payload]
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def alias
  @alias
end

#badgeObject

Returns the value of attribute badge.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def badge
  @badge
end

#except_aliasObject

Returns the value of attribute except_alias.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def except_alias
  @except_alias
end

#except_tagsObject

Returns the value of attribute except_tags.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def except_tags
  @except_tags
end

#payloadObject

Returns the value of attribute payload.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def payload
  @payload
end

#scheduleObject

Returns the value of attribute schedule.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def schedule
  @schedule
end

#soundObject

Returns the value of attribute sound.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def sound
  @sound
end

#tagsObject

Returns the value of attribute tags.



4
5
6
# File 'lib/pushbots/all.rb', line 4

def tags
  @tags
end

Instance Method Details

#bodyObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pushbots/all.rb', line 25

def body
  data = {
    platform: @platform,
    msg: message,
    schedule: schedule
  }
  data[:tags] if tags
  data[:badge] if badge
  data[:alias] if device_alias
  data[:except_tags] if except_tags
  data[:payload] if payload
  data
end

#sendObject



19
20
21
22
23
# File 'lib/pushbots/all.rb', line 19

def send
  self.response = Request.send(:all, body)
  self.status =
    response.failed? ? STATUS[:failed] : STATUS[:delivered]
end