Class: Userlist::Push
- Inherits:
-
Object
- Object
- Userlist::Push
- Defined in:
- lib/userlist/push.rb,
lib/userlist/push/user.rb,
lib/userlist/push/event.rb,
lib/userlist/push/client.rb,
lib/userlist/push/company.rb,
lib/userlist/push/relation.rb,
lib/userlist/push/resource.rb,
lib/userlist/push/strategies.rb,
lib/userlist/push/strategies/null.rb,
lib/userlist/push/operations/create.rb,
lib/userlist/push/operations/delete.rb,
lib/userlist/push/strategies/direct.rb,
lib/userlist/push/strategies/threaded.rb,
lib/userlist/push/strategies/threaded/worker.rb
Defined Under Namespace
Modules: Operations, Strategies Classes: Client, Company, Event, Relation, Resource, User
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
Instance Method Summary collapse
- #companies ⇒ Object
- #company(payload = {}) ⇒ Object
- #event(payload = {}) ⇒ Object (also: #track)
- #events ⇒ Object
-
#initialize(configuration = {}) ⇒ Push
constructor
A new instance of Push.
- #user(payload = {}) ⇒ Object (also: #identify)
- #users ⇒ Object
Constructor Details
#initialize(configuration = {}) ⇒ Push
28 29 30 31 |
# File 'lib/userlist/push.rb', line 28 def initialize(configuration = {}) @config = Userlist.config.merge(configuration) @strategy = Userlist::Push::Strategies.strategy_for(config.push_strategy, config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
33 34 35 |
# File 'lib/userlist/push.rb', line 33 def config @config end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
33 34 35 |
# File 'lib/userlist/push.rb', line 33 def strategy @strategy end |
Instance Method Details
#companies ⇒ Object
43 44 45 |
# File 'lib/userlist/push.rb', line 43 def companies @companies ||= Relation.new(self, Company, [Operations::Create, Operations::Delete]) end |
#company(payload = {}) ⇒ Object
55 56 57 |
# File 'lib/userlist/push.rb', line 55 def company(payload = {}) companies.create(payload) end |
#event(payload = {}) ⇒ Object Also known as: track
47 48 49 |
# File 'lib/userlist/push.rb', line 47 def event(payload = {}) events.create(payload) end |
#events ⇒ Object
35 36 37 |
# File 'lib/userlist/push.rb', line 35 def events @events ||= Relation.new(self, Event, [Operations::Create]) end |
#user(payload = {}) ⇒ Object Also known as: identify
51 52 53 |
# File 'lib/userlist/push.rb', line 51 def user(payload = {}) users.create(payload) end |
#users ⇒ Object
39 40 41 |
# File 'lib/userlist/push.rb', line 39 def users @users ||= Relation.new(self, User, [Operations::Create, Operations::Delete]) end |