Class: Legistar::Action

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

Instance Method Summary collapse

Constructor Details

#initialize(host:) ⇒ Action

Returns a new instance of Action.



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

def initialize(host:)
  @host = host
end

Instance Method Details

#create(options = {}) ⇒ Object



32
33
34
# File 'lib/legistar/action.rb', line 32

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

#destroy(id) ⇒ Object



40
41
42
# File 'lib/legistar/action.rb', line 40

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

#get(id) ⇒ Object



27
28
29
30
# File 'lib/legistar/action.rb', line 27

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

#indexObject

Example Response

"ActionId"=>367,
"ActionGuid"=>nil,
"ActionLastModifiedUtc"=>"2014-05-24T04:15:17.893",
"ActionRowVersion"=>"AAAAAAAeM4E=",
"ActionName"=>"Adopted As Amended",
"ActionActiveFlag"=>1,
"ActionUsedFlag"=>0



22
23
24
25
# File 'lib/legistar/action.rb', line 22

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

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



36
37
38
# File 'lib/legistar/action.rb', line 36

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