Class: Legistar::CodeSection

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

Instance Method Summary collapse

Constructor Details

#initialize(host:) ⇒ CodeSection

Returns a new instance of CodeSection.



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

def initialize(host:)
  @host = host
end

Instance Method Details

#create(options = {}) ⇒ Object



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

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

#destroy(id) ⇒ Object



41
42
43
# File 'lib/legistar/code_section.rb', line 41

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

#get(id) ⇒ Object



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

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

#indexObject

Example Response

"CodeSectionId"=>38,
"CodeSectionGuid"=>"A24F2163-A67F-47EE-860C-EDA29BACFE37",
"CodeSectionLastModifiedUtc"=>"2014-05-24T04:15:19.107",
"CodeSectionRowVersion"=>"AAAAAAAFsMc=",
"CodeSectionNumber"=>"11.222",
"CodeSectionName"=>"Water ",
"CodeSectionActiveFlag"=>1,
"CodeSectionUsedFlag"=>0



23
24
25
26
# File 'lib/legistar/code_section.rb', line 23

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

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



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

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