Class: Fellowshipone::Fund

Inherits:
Object
  • Object
show all
Defined in:
lib/fellowshipone/responses/fund.rb

Class Method Summary collapse

Class Method Details

.format(res) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/fellowshipone/responses/fund.rb', line 3

def self.format(res)
  response = res['funds']['fund']
  if response.is_a?(Array)
    response.map{|fund| format_fund(fund) }
  else
    format_fund(response)
  end
end

.format_fund(fund) ⇒ Object



12
13
14
15
16
17
# File 'lib/fellowshipone/responses/fund.rb', line 12

def self.format_fund(fund)
  OpenStruct.new(
    id:   fund["@id"],
    name: fund["name"],
  )
end