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.



493
494
495
# File 'lib/kiva.rb', line 493

def countries
  @countries
end

#default_rateObject

Returns the value of attribute default_rate.



491
492
493
# File 'lib/kiva.rb', line 491

def default_rate
  @default_rate
end

#delinquency_rateObject

Returns the value of attribute delinquency_rate.



488
489
490
# File 'lib/kiva.rb', line 488

def delinquency_rate
  @delinquency_rate
end

#idObject

Returns the value of attribute id.



489
490
491
# File 'lib/kiva.rb', line 489

def id
  @id
end

#imageObject

Returns the value of attribute image.



494
495
496
# File 'lib/kiva.rb', line 494

def image
  @image
end

#loans_postedObject

Returns the value of attribute loans_posted.



492
493
494
# File 'lib/kiva.rb', line 492

def loans_posted
  @loans_posted
end

#nameObject

Returns the value of attribute name.



487
488
489
# File 'lib/kiva.rb', line 487

def name
  @name
end

#ratingObject

Returns the value of attribute rating.



485
486
487
# File 'lib/kiva.rb', line 485

def rating
  @rating
end

#start_dateObject

Returns the value of attribute start_date.



484
485
486
# File 'lib/kiva.rb', line 484

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status.



486
487
488
# File 'lib/kiva.rb', line 486

def status
  @status
end

#total_amount_raisedObject

Returns the value of attribute total_amount_raised.



490
491
492
# File 'lib/kiva.rb', line 490

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



513
514
515
516
517
518
519
# File 'lib/kiva.rb', line 513

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