Sha256: 58f8202744e9626aef4320824e451cb2b01d78a175fe706876dffbb29ced698b
Contents?: true
Size: 640 Bytes
Versions: 1
Compression:
Stored size: 640 Bytes
Contents
module Pipekit module FieldRepository def get_by_key(key) key = Config.field_id(parent_resource, key) search_fields("key", key) end def get_by_name(name) search_fields("name", name) end private def search_fields(field_element, value) result = request.get.select { |element| element[field_element] == value } raise ResourceNotFoundError.new("#{parent_resource}Field searching by element #{field_element} for #{value} could not be found") if result.empty? result end def parent_resource resource.chomp("Field") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pipekit-1.0.0 | lib/pipekit/field_repository.rb |