Class: Kiva::LendingAction

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

Overview

LendingAction are basically a showcase of recent Kiva activity. Use the class method load to loan the last 100 lenders and the loan they sponsored.

Constant Summary collapse

KEY =
"lending_actions"
LOAD_RECENT =
"http://api.kivaws.org/v1/lending_actions/recent.json"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dateObject

Returns the value of attribute date.



353
354
355
# File 'lib/kiva.rb', line 353

def date
  @date
end

#idObject

Returns the value of attribute id.



352
353
354
# File 'lib/kiva.rb', line 352

def id
  @id
end

#lenderObject

Returns the value of attribute lender.



354
355
356
# File 'lib/kiva.rb', line 354

def lender
  @lender
end

#loanObject

Returns the value of attribute loan.



355
356
357
# File 'lib/kiva.rb', line 355

def loan
  @loan
end

Class Method Details

.loadObject

Returns the last 100 public actions from Kiva.

Returns

an array of LendingAction instances

corresponds

developers.wiki.kiva.org/KivaAPI#lendingactions/recent



371
372
373
374
375
376
377
# File 'lib/kiva.rb', line 371

def load 
  raw = Kiva.execute(LOAD_RECENT)
  unw = JSON.parse(raw)
  
  Kiva._populate  LendingAction, unw[KEY]

end