Class: Legistar::BodyType

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/legistar/body_type.rb

Instance Method Summary collapse

Constructor Details

#initialize(host:) ⇒ BodyType

Returns a new instance of BodyType.



6
7
8
# File 'lib/legistar/body_type.rb', line 6

def initialize(host:)
  @host = host
end

Instance Method Details

#create(options = {}) ⇒ Object



29
30
31
# File 'lib/legistar/body_type.rb', line 29

def create(options = {})
  response = self.class.post("/v1/#{@host}/BodyTypes/", options)
end

#destroy(id) ⇒ Object



37
38
39
# File 'lib/legistar/body_type.rb', line 37

def destroy(id)
  response = self.class.delete("/v1/#{@host}/BodyTypes/#{id}")
end

#get(id) ⇒ Object



24
25
26
27
# File 'lib/legistar/body_type.rb', line 24

def get(id)
  response = self.class.get("/v1/#{@host}/BodyTypes/#{id}")
  response.to_h
end

#indexObject

Example Response

{ “BodyTypeId”=>42, “BodyTypeGuid”=>“B3C517AA-98B9-44BF-A3DE-7B9E8B4ACB5A”, “BodyTypeLastModifiedUtc”=>“2014-05-24T04:15:18.647”, “BodyTypeRowVersion”=>“AAAAAAA0AeY=”, “BodyTypeName”=>“City Council” }



19
20
21
22
# File 'lib/legistar/body_type.rb', line 19

def index
  response = self.class.get("/v1/#{@host}/BodyTypes")
  actions = response.to_a
end

#update(id, options = {}) ⇒ Object



33
34
35
# File 'lib/legistar/body_type.rb', line 33

def update(id, options = {})
  response = self.class.put("/v1/#{@host}/BodyTypes/#{id}", options)
end