Class: Kiva::Team

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Api

app_id, app_id=, friendly, friendly=, included

Methods included from DynamicInitializer

included

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def category
  @category
end

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def description
  @description
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def id
  @id
end

#imageObject

Returns the value of attribute image.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def image
  @image
end

#loan_becauseObject

Returns the value of attribute loan_because.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def loan_because
  @loan_because
end

#loan_countObject

Returns the value of attribute loan_count.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def loan_count
  @loan_count
end

#loaned_amountObject

Returns the value of attribute loaned_amount.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def loaned_amount
  @loaned_amount
end

#member_countObject

Returns the value of attribute member_count.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def member_count
  @member_count
end

#membership_typeObject

Returns the value of attribute membership_type.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def membership_type
  @membership_type
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def name
  @name
end

#shortnameObject

Returns the value of attribute shortname.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def shortname
  @shortname
end

#website_urlObject

Returns the value of attribute website_url.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def website_url
  @website_url
end

#whereaboutsObject

Returns the value of attribute whereabouts.



7
8
9
# File 'lib/ruby-kiva/team.rb', line 7

def whereabouts
  @whereabouts
end

Class Method Details

.find(params) ⇒ Object

find a team by :id or :shortname



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ruby-kiva/team.rb', line 21

def self.find(params)
  if params[:id]
    data = get("/teams/#{sanitize_id_parameter(params[:id])}.json", :query => sanitize_options(params))
    many = sanitize_id_parameter(params[:id]).include?(',')
  elsif params[:shortname]
    data = get("/teams/using_shortname/#{sanitize_id_parameter(params[:shortname])}.json", :query => sanitize_options(params))
    many = sanitize_id_parameter(params[:shortnames]).include?(',')
  else
    data = get("/teams/search.json", :query => sanitize_options(params))
    many = true
  end
  json_to_paged_array(data, 'teams', many)
end

Instance Method Details

#lenders(params = {}) ⇒ Object



13
14
15
# File 'lib/ruby-kiva/team.rb', line 13

def lenders(params = {})
  @lenders ||= Lender.find(params.merge({:team_id => self.id}))
end

#loans(params = {}) ⇒ Object



16
17
18
# File 'lib/ruby-kiva/team.rb', line 16

def loans(params = {})
  @loans ||= Loan.find(params.merge({:team_id => self.id}))
end