Class: Cocupu::Pool
- Inherits:
-
Object
- Object
- Cocupu::Pool
- Defined in:
- lib/cocupu/pool.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
Returns the value of attribute conn.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(values, conn) ⇒ Pool
constructor
A new instance of Pool.
- #models ⇒ Object
- #short_name ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(values, conn) ⇒ Pool
Returns a new instance of Pool.
4 5 6 7 |
# File 'lib/cocupu/pool.rb', line 4 def initialize(values, conn) self.conn = conn self.values = values end |
Instance Attribute Details
#conn ⇒ Object
Returns the value of attribute conn.
3 4 5 |
# File 'lib/cocupu/pool.rb', line 3 def conn @conn end |
#values ⇒ Object
Returns the value of attribute values.
3 4 5 |
# File 'lib/cocupu/pool.rb', line 3 def values @values end |
Instance Method Details
#models ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/cocupu/pool.rb', line 16 def models return @models if @models # req_url = "http://#{host}:#{port}#{url}/models.json?auth_token=#{token}" # puts "Calling #{req_url}" response = conn.get("#{url}/models.json") #puts "RESP: #{response}" raise "Error getting models: #{response}" unless response.code == 200 @pools = response.map {|val| Model.new(val, conn)} end |
#short_name ⇒ Object
8 9 10 |
# File 'lib/cocupu/pool.rb', line 8 def short_name values["short_name"] end |
#url ⇒ Object
12 13 14 |
# File 'lib/cocupu/pool.rb', line 12 def url values["url"] end |