Method: Osm::Term#update
- Defined in:
- lib/osm/term.rb
#update(api) ⇒ Boolean
Update a term in OSM
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/osm/term.rb', line 161 def update(api) raise Osm::ObjectIsInvalid, 'term is invalid' unless valid? require_access_to_section(api, section_id) data = api.perform_query("users.php?action=addTerm§ionid=#{section_id}", { 'term' => name, 'start' => start.strftime(Osm::OSM_DATE_FORMAT), 'end' => finish.strftime(Osm::OSM_DATE_FORMAT), 'termid' => id }) if data.is_a?(Hash) && data['terms'].is_a?(Hash) reset_changed_attributes # The cached term will be out of date - remove it cache_delete(api, ['term', id]) return true else return false end end |