Sha256: e96f9757274467c70083213250a6de9345b2081d70c05d034feda4b96b2403f8

Contents?: true

Size: 1013 Bytes

Versions: 3

Compression:

Stored size: 1013 Bytes

Contents

module Rexpense
  module Resources
    #
    # A wrapper to Rexpense expenses API
    #
    # [API]
    #   Documentation: http://developers.rexpense.com/api/v1/expenses/
    #
    class Expense < ResourceBase
      include Rexpense::Resources::Comment
      include Rexpense::Resources::Participant
      include Rexpense::Resources::Attachment

      def status(id)
        http.get("#{search_endpoint}/#{id}/status") do |response|
          Rexpense::Entities::ExpenseStatus.new response.parsed_body
        end
      end

      def update_status(id, params)
        http.put("#{search_endpoint}/#{id}/status", body: params) do |response|
          Rexpense::Entities::ExpenseStatus.new response.parsed_body
        end
      end

      def mentionables(id)
        http.get("#{endpoint_base}/#{id}/mentionables") do |response|
          Rexpense::Entities::UserCollection.build response.parsed_body
        end
      end

      private

      def endpoint_base
        "/expenses"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rexpense-2.1.0 lib/rexpense/resources/expense.rb
rexpense-2.0.0 lib/rexpense/resources/expense.rb
rexpense-1.0.0 lib/rexpense/resources/expense.rb