Module: Caselaw::Cases
- Included in:
- Client
- Defined in:
- lib/caselaw/client/cases.rb
Constant Summary collapse
- API_ENDPOINT =
"cases/"
Instance Method Summary collapse
- #case(id, full_case = false) ⇒ Object
- #cases_by_jurisdiction(jurisdiction_term, num_cases, full_case = false) ⇒ Object
-
#search_cases(term, num_cases, jurisdiction_term = nil) ⇒ Object
Search through text of cases and return cases that contain the word.
Instance Method Details
#case(id, full_case = false) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/caselaw/client/cases.rb', line 5 def case(id, full_case = false) id_path = id.to_s path = API_ENDPOINT + id_path path = path + "?full_case=true" if full_case == true Hashie::Mash.new(request(path)) end |
#cases_by_jurisdiction(jurisdiction_term, num_cases, full_case = false) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/caselaw/client/cases.rb', line 12 def cases_by_jurisdiction(jurisdiction_term, num_cases, full_case = false) slug = slug(jurisdiction_term) path = API_ENDPOINT + "?jurisdiction=" + slug path = path + "&full_case=true" if full_case == true tempArray = paginated_request(path, num_cases) Hashie::Mash.new(resultsCount: tempArray.count, results: tempArray) end |
#search_cases(term, num_cases, jurisdiction_term = nil) ⇒ Object
Search through text of cases and return cases that contain the word
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/caselaw/client/cases.rb', line 21 def search_cases(term, num_cases, jurisdiction_term=nil) if jurisdiction_term != nil slug = slug(jurisdiction_term) path = API_ENDPOINT + "?search=" + term + "&jurisdiction=" + slug else path = API_ENDPOINT + "?search=" + term end tempArray = paginated_request(path, num_cases) Hashie::Mash.new(resultsCount: tempArray.count, results: tempArray) end |