Module: ZendeskAPI::Associations::ClassMethods

Defined in:
lib/zendesk_api/associations.rb

Defined Under Namespace

Modules: Has, HasMany

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



33
34
35
36
# File 'lib/zendesk_api/associations.rb', line 33

def self.extended(klass)
  klass.extend Has
  klass.extend HasMany
end

Instance Method Details

#associated_with(name) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/zendesk_api/associations.rb', line 42

def associated_with(name)
  associations.inject([]) do |associated_with, association|
    if association[:include] == name.to_s
      associated_with.push(Association.new(association))
    end

    associated_with
  end
end

#associationsObject



38
39
40
# File 'lib/zendesk_api/associations.rb', line 38

def associations
  @associations ||= []
end