Class: TrailAPI::Organization
- Inherits:
-
Base
- Object
- Base
- TrailAPI::Organization
show all
- Defined in:
- lib/trail_api/organization.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 ⇒ Object
9
10
11
|
# File 'lib/trail_api/organization.rb', line 9
def self.all
hashize get( api_path_for.api_v1_organizations_path )
end
|
.create(new_params) ⇒ Object
32
33
34
35
|
# File 'lib/trail_api/organization.rb', line 32
def self.create( new_params )
params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
hashize post( api_path_for.api_v1_organizations_path , :body => ActiveSupport::JSON.encode(params) )
end
|
.destroy(organization_id) ⇒ Object
37
38
39
|
# File 'lib/trail_api/organization.rb', line 37
def self.destroy( organization_id )
hashize delete( api_path_for.api_v1_organization_path organization_id )
end
|
.show(organization_id) ⇒ Object
13
14
15
16
|
# File 'lib/trail_api/organization.rb', line 13
def self.show( organization_id )
hashize get( api_path_for.api_v1_organization_path organization_id )
end
|
.update(organization_id, new_params) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/trail_api/organization.rb', line 18
def self.update( organization_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_path(organization_id ),
:body => ActiveSupport::JSON.encode(params),
:basic_auth => default_options[:basic_auth],
:headers => {'Accept' => 'application/json', 'Content-Type' => 'application/json'},
:format => :json).perform
end
|