Class: Mixpannenkoek::Base

Inherits:
Object
  • Object
show all
Extended by:
ClassInheritableAttribute
Defined in:
lib/mixpannenkoek/base.rb

Class Method Summary collapse

Methods included from ClassInheritableAttribute

class_inheritable_attribute, create_getter, create_setter

Class Method Details

.api_keyObject



20
21
22
# File 'lib/mixpannenkoek/base.rb', line 20

def self.api_key
  value_from_block(self._api_key)
end

.api_secretObject



24
25
26
# File 'lib/mixpannenkoek/base.rb', line 24

def self.api_secret
  value_from_block(self._api_secret)
end

.default_scope(&proc_or_lambda) ⇒ Object

End class methods



52
53
54
55
# File 'lib/mixpannenkoek/base.rb', line 52

def self.default_scope(&proc_or_lambda)
  self._default_scope ||= []
  self._default_scope += [proc_or_lambda]
end

.default_scopesObject



57
58
59
60
# File 'lib/mixpannenkoek/base.rb', line 57

def self.default_scopes
  self._default_scope ||= []
  self._default_scope.map{ |p| p.call }
end

.endpointObject



28
29
30
# File 'lib/mixpannenkoek/base.rb', line 28

def self.endpoint
  value_from_block(self._endpoint)
end

.group(field) ⇒ Object



46
47
48
# File 'lib/mixpannenkoek/base.rb', line 46

def self.group(field)
  Mixpannenkoek::Query.new(self).group(field)
end

.set(variable) ⇒ Object



42
43
44
# File 'lib/mixpannenkoek/base.rb', line 42

def self.set(variable)
  Mixpannenkoek::Query.new(self).set(variable)
end

.set_api_key(api_key = nil, &block) ⇒ Object



8
9
10
# File 'lib/mixpannenkoek/base.rb', line 8

def self.set_api_key(api_key = nil, &block)
  self._api_key = value_or_block(api_key, &block)
end

.set_api_secret(api_secret = nil, &block) ⇒ Object



12
13
14
# File 'lib/mixpannenkoek/base.rb', line 12

def self.set_api_secret(api_secret = nil, &block)
  self._api_secret = value_or_block(api_secret, &block)
end

.set_endpoint(endpoint = nil, &block) ⇒ Object



16
17
18
# File 'lib/mixpannenkoek/base.rb', line 16

def self.set_endpoint(endpoint = nil, &block)
  self._endpoint = value_or_block(endpoint, &block)
end

.where(condition) ⇒ Object

Class methods (for convenience)

these methods enable this type of usage: Mixpanel::Query.where(training_name: ‘Training XYZ’).group(‘subject_name’).results



38
39
40
# File 'lib/mixpannenkoek/base.rb', line 38

def self.where(condition)
  Mixpannenkoek::Query.new(self).where(condition)
end