Class: StrapiModel::Query
- Inherits:
-
Object
- Object
- StrapiModel::Query
- Defined in:
- lib/strapi_model/query.rb
Class Method Summary collapse
Class Method Details
.get(api_id = '', params = '', entry_id = nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/strapi_model/query.rb', line 8 def get(api_id = '', params = '', entry_id= nil) if entry_id.present? response = http.get("#{host}/api/#{api_id}/#{entry_id}?#{params}") else response = http.get("#{host}/api/#{api_id}?#{params}") end response.code == 404 ? raise(Strapi::Errors::RecordNotFound) : JSON.parse(response.to_s, symbolize_names: true) end |