Method: Osm::Budget#delete

Defined in:
lib/osm/budget.rb

#delete(api) ⇒ Boolean

Delete budget from OSM

Parameters:

  • api (Osm::Api)

    The api to use to make the request

Returns:

  • (Boolean)

    whether the budget was deleted



116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/osm/budget.rb', line 116

def delete(api)
  Osm::Model.require_ability_to(api, :write, :finance, section_id)

  data = api.perform_query("finances.php?action=deleteCategory&sectionid=#{section_id}", {
    'categoryid' => id,
  })
  if (data.is_a?(Hash) && data['ok'].eql?(true))
    # The cached budgets for the section will be out of date - remove them
    cache_delete(api, ['budgets', section_id])
    return true
  end
  return false
end