class Infreemation::Request
This class represents a FOI or EIR request
Attributes
attributes[R]
Public Class Methods
create!(attributes = {})
click to toggle source
# File lib/infreemation/request.rb, line 13 def create!(attributes = {}) new(attributes, &:save!) end
new(attributes = {}) { |self| ... }
click to toggle source
# File lib/infreemation/request.rb, line 26 def initialize(attributes = {}) @attributes = attributes yield self if block_given? end
path()
click to toggle source
# File lib/infreemation/request.rb, line 9 def path '/foi/' end
where(options = {})
click to toggle source
# File lib/infreemation/request.rb, line 17 def where(options = {}) type = options.fetch(:rt).downcase.to_sym requests_data = API.get(path, options).dig(type, :request) || [] requests_data.map { |attributes| new(attributes) } end
Public Instance Methods
save!()
click to toggle source
# File lib/infreemation/request.rb, line 31 def save! @attributes.merge!(API.post(self.class.path, attributes)) true end