Class: JPush::Push::Audience

Inherits:
Object
  • Object
show all
Defined in:
lib/jpush/push/audience.rb

Instance Method Summary collapse

Instance Method Details

#set_abtest(abtest) ⇒ Object



35
36
37
38
# File 'lib/jpush/push/audience.rb', line 35

def set_abtest(abtest)
  @abtest = [abtest].flatten
  self
end

#set_alias(alis) ⇒ Object



20
21
22
23
# File 'lib/jpush/push/audience.rb', line 20

def set_alias(alis)
  @alias = [alis].flatten
  self
end

#set_registration_id(registration_ids) ⇒ Object



25
26
27
28
# File 'lib/jpush/push/audience.rb', line 25

def set_registration_id(registration_ids)
  @registration_id = [registration_ids].flatten
  self
end

#set_segment(segment) ⇒ Object



30
31
32
33
# File 'lib/jpush/push/audience.rb', line 30

def set_segment(segment)
  @segment = [segment].flatten
  self
end

#set_tag(tags) ⇒ Object



5
6
7
8
# File 'lib/jpush/push/audience.rb', line 5

def set_tag(tags)
  @tag = [tags].flatten
  self
end

#set_tag_and(tags) ⇒ Object



10
11
12
13
# File 'lib/jpush/push/audience.rb', line 10

def set_tag_and(tags)
  @tag_and = [tags].flatten
  self
end

#set_tag_not(tags) ⇒ Object



15
16
17
18
# File 'lib/jpush/push/audience.rb', line 15

def set_tag_not(tags)
  @tag_not = [tags].flatten
  self
end

#to_hashObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/jpush/push/audience.rb', line 40

def to_hash
  @audience = {
    tag: @tag,
    tag_and: @tag_and,
    tag_not: @tag_not,
    alias: @alias,
    registration_id: @registration_id,
    segment: @segment,
    abtest: @abtest
  }.select { |_, value| !value.nil? }
  @audience
end