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/serializer.rb,
lib/userlist/push/strategies.rb,
lib/userlist/push/relationship.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/sidekiq.rb,
lib/userlist/push/resource_collection.rb,
lib/userlist/push/strategies/threaded.rb,
lib/userlist/push/strategies/sidekiq/worker.rb,
lib/userlist/push/strategies/threaded/worker.rb
Defined Under Namespace
Modules: Operations, Strategies Classes: Client, Company, Event, Relation, Relationship, Resource, ResourceCollection, Serializer, 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.
- #relationships ⇒ Object
- #user(payload = {}) ⇒ Object (also: #identify)
- #users ⇒ Object
Constructor Details
#initialize(configuration = {}) ⇒ Push
Returns a new instance of Push.
32 33 34 35 |
# File 'lib/userlist/push.rb', line 32 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.
37 38 39 |
# File 'lib/userlist/push.rb', line 37 def config @config end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
37 38 39 |
# File 'lib/userlist/push.rb', line 37 def strategy @strategy end |
Instance Method Details
#companies ⇒ Object
47 48 49 |
# File 'lib/userlist/push.rb', line 47 def companies @companies ||= Relation.new(self, Company, [Operations::Create, Operations::Delete]) end |
#company(payload = {}) ⇒ Object
63 64 65 |
# File 'lib/userlist/push.rb', line 63 def company(payload = {}) companies.create(payload) end |
#event(payload = {}) ⇒ Object Also known as: track
55 56 57 |
# File 'lib/userlist/push.rb', line 55 def event(payload = {}) events.create(payload) end |
#events ⇒ Object
39 40 41 |
# File 'lib/userlist/push.rb', line 39 def events @events ||= Relation.new(self, Event, [Operations::Create]) end |
#relationships ⇒ Object
51 52 53 |
# File 'lib/userlist/push.rb', line 51 def relationships @relationships ||= Relation.new(self, Relationship, [Operations::Create, Operations::Delete]) end |
#user(payload = {}) ⇒ Object Also known as: identify
59 60 61 |
# File 'lib/userlist/push.rb', line 59 def user(payload = {}) users.create(payload) end |
#users ⇒ Object
43 44 45 |
# File 'lib/userlist/push.rb', line 43 def users @users ||= Relation.new(self, User, [Operations::Create, Operations::Delete]) end |