Class: Kiva::Partner

Inherits:
Object
  • Object
show all
Includes:
Api, DynamicInitializer
Defined in:
lib/ruby-kiva/partner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from DynamicInitializer

included

Methods included from Api

app_id, app_id=, friendly, friendly=, included

Instance Attribute Details

#default_rateObject

Returns the value of attribute default_rate.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def default_rate
  @default_rate
end

#delinquency_rateObject

Returns the value of attribute delinquency_rate.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def delinquency_rate
  @delinquency_rate
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def id
  @id
end

#loans_postedObject

Returns the value of attribute loans_posted.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def loans_posted
  @loans_posted
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def name
  @name
end

#ratingObject

Returns the value of attribute rating.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def rating
  @rating
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def status
  @status
end

#total_amount_raisedObject

Returns the value of attribute total_amount_raised.



5
6
7
# File 'lib/ruby-kiva/partner.rb', line 5

def total_amount_raised
  @total_amount_raised
end

Class Method Details

.find(params = {}) ⇒ Object

Find a partner either by :id or all of them Since kiva does not offer search, finding by id is implemented in memory/ruby. Pagination is not supported, page size is 200 and currently there are 143 partners Items are cached but can be reloaded by passing :reload => true (caching is suggested by kiva…)



16
17
18
19
20
21
22
# File 'lib/ruby-kiva/partner.rb', line 16

def self.find(params = {})
  if params[:id]
    find().detect() {|item| item.id == params[:id]}
  else
    find_all(params)
  end
end