Sha256: ec3cf00da6f7061e2dfbd3b0accf5f65958c25880c74c0630779e5a744665184

Contents?: true

Size: 432 Bytes

Versions: 5

Compression:

Stored size: 432 Bytes

Contents

module Economic
  class JournalVoucherRepo < Economic::BaseRepo
    def self.save(voucher)
      response = send_request(method: :post, url: "#{Economic::JournalRepo.endpoint_url}/#{voucher.journal.journalNumber}/vouchers", payload: voucher.to_h.to_json)

      Voucher.new(JSON.parse(response.body).first)
    end

    def self.endpoint_name
      raise StandardError, "only save is available on this repository"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
economic-rest-0.6.4 lib/economic/journal_voucher_repo.rb
economic-rest-0.6.3 lib/economic/journal_voucher_repo.rb
economic-rest-0.6.2 lib/economic/journal_voucher_repo.rb
economic-rest-0.6.1 lib/economic/journal_voucher_repo.rb
economic-rest-0.6.0 lib/economic/journal_voucher_repo.rb