Module: Supplejack::Concept::ClassMethods
- Defined in:
- lib/supplejack/concept.rb
Instance Method Summary collapse
-
#find(id, options = {}) ⇒ Supplejack::Concept
Finds a record or array of records from the Supplejack API.
Instance Method Details
#find(id, options = {}) ⇒ Supplejack::Concept
Finds a record or array of records from the Supplejack API
Supplejack::Concept module was included
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/supplejack/concept.rb', line 70 def find(id, ={}) begin # handle malformed id's before requesting anything. id = id.to_i raise(Supplejack::MalformedRequest, "'#{id}' is not a valid concept id") if id <= 0 # This will not work until the Concepts API supports groups properly #options = options.merge({fields: 'default'}) response = get("/concepts/#{id}", ) new(response) rescue RestClient::ResourceNotFound => e raise Supplejack::ConceptNotFound, "Concept with ID #{id} was not found" end end |