Class: Devrant::Rants

Inherits:
Object
  • Object
show all
Includes:
Devrant, HTTParty
Defined in:
lib/devrant/rants.rb

Constant Summary

Constants included from Devrant

VERSION

Instance Method Summary collapse

Methods included from Devrant

#structuralize

Instance Method Details

#allObject



6
7
8
# File 'lib/devrant/rants.rb', line 6

def all
  structuralize(self.class.get('/devrant/rants')).rants
end

#get_rant(id) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
# File 'lib/devrant/rants.rb', line 10

def get_rant(id)
  rant = structuralize(self.class.get("/devrant/rants/#{id}")).rant

  return rant unless rant.nil?

  raise ArgumentError.new("No rant found for id #{id}")
end

#get_rants(params = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/devrant/rants.rb', line 18

def get_rants(params={})
  options = {
    query: self.class.default_options[:query].merge(params)
  }

  rants = structuralize(self.class.get("/devrant/rants", options)).rants 
end