Class: Kiva::Partner

Inherits:
Object
  • Object
show all
Defined in:
lib/kiva.rb

Overview

Kiva field Partner

Constant Summary collapse

KEY =
"partners"
LOAD =
"http://api.kivaws.org/v1/partners.json?"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#countriesObject

Returns the value of attribute countries.



527
528
529
# File 'lib/kiva.rb', line 527

def countries
  @countries
end

#default_rateObject

Returns the value of attribute default_rate.



525
526
527
# File 'lib/kiva.rb', line 525

def default_rate
  @default_rate
end

#delinquency_rateObject

Returns the value of attribute delinquency_rate.



522
523
524
# File 'lib/kiva.rb', line 522

def delinquency_rate
  @delinquency_rate
end

#idObject

Returns the value of attribute id.



523
524
525
# File 'lib/kiva.rb', line 523

def id
  @id
end

#imageObject

Returns the value of attribute image.



528
529
530
# File 'lib/kiva.rb', line 528

def image
  @image
end

#loans_postedObject

Returns the value of attribute loans_posted.



526
527
528
# File 'lib/kiva.rb', line 526

def loans_posted
  @loans_posted
end

#nameObject

Returns the value of attribute name.



521
522
523
# File 'lib/kiva.rb', line 521

def name
  @name
end

#ratingObject

Returns the value of attribute rating.



519
520
521
# File 'lib/kiva.rb', line 519

def rating
  @rating
end

#start_dateObject

Returns the value of attribute start_date.



518
519
520
# File 'lib/kiva.rb', line 518

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status.



520
521
522
# File 'lib/kiva.rb', line 520

def status
  @status
end

#total_amount_raisedObject

Returns the value of attribute total_amount_raised.



524
525
526
# File 'lib/kiva.rb', line 524

def total_amount_raised
  @total_amount_raised
end

Class Method Details

.load(page = nil) ⇒ Object

Load an alphabetically sorted list of partners.

Parameters

page: page position

Returns

an array of Partner instances

Corresponds

developers.wiki.kiva.org/KivaAPI#partners



547
548
549
550
551
552
553
# File 'lib/kiva.rb', line 547

def load page=nil
  url = page ? LOAD + "page=#{page}" : LOAD
  raw = raw = Kiva.execute(url)
  unw = JSON.parse(raw)
  
  Kiva._populate self, unw[KEY]
end