Class: TrailAPI::Fund
- Inherits:
-
Base
- Object
- Base
- TrailAPI::Fund
show all
- Defined in:
- lib/trail_api/fund.rb
Class Method Summary
collapse
Methods inherited from Base
api_path_for, auth, hashize, #initialize, url_options
Constructor Details
This class inherits a constructor from TrailAPI::Base
Class Method Details
.all(organization_id) ⇒ Object
8
9
10
|
# File 'lib/trail_api/fund.rb', line 8
def self.all(organization_id)
hashize get( api_path_for.api_v1_organization_funds_path( organization_id ) )
end
|
.create(organization_id, new_params) ⇒ Object
31
32
33
34
35
|
# File 'lib/trail_api/fund.rb', line 31
def self.create( organization_id, new_params )
new_params[:fund].merge! :organization_id => organization_id
params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
hashize post( api_path_for.api_v1_organization_funds_path( organization_id), :body => ActiveSupport::JSON.encode(params) )
end
|
.destroy(organization_id, fund_id) ⇒ Object
37
38
39
|
# File 'lib/trail_api/fund.rb', line 37
def self.destroy( organization_id, fund_id )
hashize delete( api_path_for.api_v1_organization_fund_path( organization_id , fund_id) )
end
|
.show(organization_id, fund_id) ⇒ Object
12
13
14
15
|
# File 'lib/trail_api/fund.rb', line 12
def self.show( organization_id , fund_id )
hashize get( api_path_for.api_v1_organization_fund_path( organization_id , fund_id))
end
|
.update(organization_id, fund_id, new_params) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/trail_api/fund.rb', line 17
def self.update( organization_id, fund_id , new_params )
params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
hashize HTTParty::Request.new( Net::HTTP::Put,
"http://" + TrailAPI.uri + api_path_for.api_v1_organization_fund_path( organization_id , fund_id),
:body => ActiveSupport::JSON.encode(params),
:basic_auth => default_options[:basic_auth],
:headers => {'Accept' => 'application/json', 'Content-Type' => 'application/json'},
:format => :json).perform
end
|