Class: Userlist::Push::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/userlist/push/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, type, operations = []) ⇒ Relation

Returns a new instance of Relation.



4
5
6
7
8
9
# File 'lib/userlist/push/relation.rb', line 4

def initialize(scope, type, operations = [])
  @scope = scope
  @type = type

  operations.each { |operation| singleton_class.send(:include, operation::ClassMethods) }
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



11
12
13
# File 'lib/userlist/push/relation.rb', line 11

def scope
  @scope
end

#typeObject (readonly)

Returns the value of attribute type.



11
12
13
# File 'lib/userlist/push/relation.rb', line 11

def type
  @type
end

Instance Method Details

#configObject



25
26
27
# File 'lib/userlist/push/relation.rb', line 25

def config
  scope.config
end

#endpointObject



17
18
19
# File 'lib/userlist/push/relation.rb', line 17

def endpoint
  type.endpoint
end

#from_payload(payload, config = self.config) ⇒ Object



13
14
15
# File 'lib/userlist/push/relation.rb', line 13

def from_payload(payload, config = self.config)
  type.from_payload(payload, config)
end

#strategyObject



21
22
23
# File 'lib/userlist/push/relation.rb', line 21

def strategy
  scope.strategy
end