Sha256: a73143ca54c85c8db94c835b153656a837b359adb1f270dd79ba181431bc2a5d

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

class Auth::Endpoint
	
	include Mongoid::Document
		
	field :android_endpoint, type: String
	field :ios_endpoint, type: String
	field :android_token, type: String
	field :ios_token, type: String

	before_save :set_android_endpoint
	before_save :set_ios_endpoint

	def set_android_endpoint
		return unless self.android_token
		if response = $sns_client.create_platform_endpoint(platform_application_arn: ENV["ANDROID_ARN"], token: self.android_token, attributes: {})
			self.android_endpoint = response.endpoint_arn
			self.android_endpoint
		else
			nil
		end
	end

	def set_ios_endpoint
		return unless self.ios_token
	end


end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wordjelly-auth-1.1.7 app/models/auth/endpoint.rb
wordjelly-auth-1.1.6 app/models/auth/endpoint.rb
wordjelly-auth-1.1.5 app/models/auth/endpoint.rb
wordjelly-auth-1.1.4 app/models/auth/endpoint.rb