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.


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

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

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace


7
8
9
# File 'lib/travis/client/namespace.rb', line 7

def namespace
  @namespace
end

#typeObject

Returns the value of attribute type


7
8
9
# File 'lib/travis/client/namespace.rb', line 7

def type
  @type
end

Instance Method Details

#currentObject


19
20
21
22
23
# File 'lib/travis/client/namespace.rb', line 19

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


25
26
27
28
29
# File 'lib/travis/client/namespace.rb', line 25

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


13
14
15
16
17
# File 'lib/travis/client/namespace.rb', line 13

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