Module: Pusher::PushNotifications

Defined in:
lib/pusher/push_notifications.rb,
lib/pusher/push_notifications/token.rb,
lib/pusher/push_notifications/client.rb,
lib/pusher/push_notifications/user_id.rb,
lib/pusher/push_notifications/version.rb,
lib/pusher/push_notifications/use_cases/publish.rb,
lib/pusher/push_notifications/use_cases/delete_user.rb,
lib/pusher/push_notifications/use_cases/generate_token.rb,
lib/pusher/push_notifications/use_cases/publish_to_users.rb

Defined Under Namespace

Modules: UseCases Classes: Client, PushError, Token, UserId

Constant Summary collapse

VERSION =
'2.0.2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.instance_idObject

Returns the value of attribute instance_id.



17
18
19
# File 'lib/pusher/push_notifications.rb', line 17

def instance_id
  @instance_id
end

.secret_keyObject

Returns the value of attribute secret_key.



17
18
19
# File 'lib/pusher/push_notifications.rb', line 17

def secret_key
  @secret_key
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



19
20
21
22
23
24
# File 'lib/pusher/push_notifications.rb', line 19

def configure
  yield(self)
  # returning a duplicate of `self` to allow multiple clients to be
  # configured without needing to reconfigure the singleton instance
  dup
end

.delete_user(user:) ⇒ Object



62
63
64
# File 'lib/pusher/push_notifications.rb', line 62

def delete_user(user:)
  UseCases::DeleteUser.delete_user(client, user: user)
end

.endpointObject



44
45
46
47
48
# File 'lib/pusher/push_notifications.rb', line 44

def endpoint
  return @endpoint unless @endpoint.nil?

  "https://#{@instance_id}.pushnotifications.pusher.com"
end

.endpoint=(endpoint) ⇒ Object

Raises:



38
39
40
41
42
# File 'lib/pusher/push_notifications.rb', line 38

def endpoint=(endpoint)
  raise PushError, 'Invalid endpoint override' if !endpoint.nil? && endpoint.delete(' ').empty?

  @endpoint = endpoint
end

.generate_token(user:) ⇒ Object



66
67
68
# File 'lib/pusher/push_notifications.rb', line 66

def generate_token(user:)
  UseCases::GenerateToken.generate_token(user: user)
end

.publish(interests:, payload: {}) ⇒ Object



50
51
52
# File 'lib/pusher/push_notifications.rb', line 50

def publish(interests:, payload: {})
  UseCases::Publish.publish(client, interests: interests, payload: payload)
end

.publish_to_interests(interests:, payload: {}) ⇒ Object



54
55
56
# File 'lib/pusher/push_notifications.rb', line 54

def publish_to_interests(interests:, payload: {})
  UseCases::Publish.publish_to_interests(client, interests: interests, payload: payload)
end

.publish_to_users(users:, payload: {}) ⇒ Object



58
59
60
# File 'lib/pusher/push_notifications.rb', line 58

def publish_to_users(users:, payload: {})
  UseCases::PublishToUsers.publish_to_users(client, users: users, payload: payload)
end