Class: Travis::Client::Namespace::Curry

Inherits:
Module
  • Object
show all
Defined in:
lib/travis/client/namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, type) ⇒ Curry

Returns a new instance of Curry.



11
12
13
14
# File 'lib/travis/client/namespace.rb', line 11

def initialize(namespace, type)
  @namespace = namespace
  @type = type
end

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace.



9
10
11
# File 'lib/travis/client/namespace.rb', line 9

def namespace
  @namespace
end

#typeObject

Returns the value of attribute type.



9
10
11
# File 'lib/travis/client/namespace.rb', line 9

def type
  @type
end

Instance Method Details

#clear_cacheObject



37
38
39
# File 'lib/travis/client/namespace.rb', line 37

def clear_cache
  session.clear_cache
end

#clear_cache!Object



41
42
43
# File 'lib/travis/client/namespace.rb', line 41

def clear_cache!
  session.clear_cache!
end

#currentObject



22
23
24
25
26
# File 'lib/travis/client/namespace.rb', line 22

def current
  result = session.find_one_or_many(type)
  Array(result).each { |e| e.curry = self }
  result
end

#find_many(params = {}) ⇒ Object Also known as: find_all



28
29
30
31
32
# File 'lib/travis/client/namespace.rb', line 28

def find_many(params = {})
  session.find_many(type, params).each do |entity|
    entity.curry = self
  end
end

#find_one(id = nil) ⇒ Object Also known as: find



16
17
18
19
20
# File 'lib/travis/client/namespace.rb', line 16

def find_one(id = nil)
  result = session.find_one(type, id)
  result.curry = self
  result
end