Class: NCMB::Push

Inherits:
Object
  • Object
show all
Includes:
NCMB
Defined in:
lib/ncmb/push.rb

Constant Summary

Constants included from NCMB

API_VERSION, DOMAIN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NCMB

initialize

Instance Attribute Details

#aclObject

Returns the value of attribute acl.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def acl
  @acl
end

#actionObject

Returns the value of attribute action.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def action
  @action
end

#badgeIncrementFlagObject

Returns the value of attribute badgeIncrementFlag.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def badgeIncrementFlag
  @badgeIncrementFlag
end

#badgeSettingObject

Returns the value of attribute badgeSetting.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def badgeSetting
  @badgeSetting
end

#contentAvailableObject

Returns the value of attribute contentAvailable.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def contentAvailable
  @contentAvailable
end

#createDateObject

Returns the value of attribute createDate.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def createDate
  @createDate
end

#deliveryExpirationDateObject

Returns the value of attribute deliveryExpirationDate.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def deliveryExpirationDate
  @deliveryExpirationDate
end

#deliveryExpirationTimeObject

Returns the value of attribute deliveryExpirationTime.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def deliveryExpirationTime
  @deliveryExpirationTime
end

#deliveryTimeObject

Returns the value of attribute deliveryTime.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def deliveryTime
  @deliveryTime
end

#dialogObject

Returns the value of attribute dialog.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def dialog
  @dialog
end

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def errors
  @errors
end

#immediateDeliveryFlagObject

Returns the value of attribute immediateDeliveryFlag.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def immediateDeliveryFlag
  @immediateDeliveryFlag
end

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def message
  @message
end

#objectIdObject

Returns the value of attribute objectId.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def objectId
  @objectId
end

#richUrlObject

Returns the value of attribute richUrl.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def richUrl
  @richUrl
end

#searchConditionObject

Returns the value of attribute searchCondition.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def searchCondition
  @searchCondition
end

#soundObject

Returns the value of attribute sound.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def sound
  @sound
end

#targetObject

Returns the value of attribute target.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def target
  @target
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def title
  @title
end

#userSettingValueObject

Returns the value of attribute userSettingValue.



4
5
6
# File 'lib/ncmb/push.rb', line 4

def userSettingValue
  @userSettingValue
end

Instance Method Details

#saveObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ncmb/push.rb', line 8

def save
  path = "/#{@@client.api_version}/push"
  queries = {}
  [:deliveryTime, :immediateDeliveryFlag, :target, :searchCondition, :message,
   :userSettingValue, :deliveryExpirationDate, :deliveryExpirationTime, :action, :title, :dialog,
   :badgeIncrementFlag, :badgeSetting, :sound, :contentAvailable, :richUrl, :acl].each do |name|
    queries[name] = send(name) unless send(name).nil?
  end
  results = @@client.post path, queries
  if results[:objectId].nil?
    self.errors = results
    return false
  end
  self.objectId = results[:objectId]
  self.createDate = results[:createDate]
  return true
end