Sha256: 2c0f4c8f9cb163f8a1d36caefadadce9c6c168def3a3f31fcc495934fb15c4fe

Contents?: true

Size: 454 Bytes

Versions: 24

Compression:

Stored size: 454 Bytes

Contents

module Economic
  class JournalVoucherRepo < Economic::BaseRepo
    def self.save(voucher)
      response = send_request(method: :post, url: URI.escape(Economic::JournalRepo.endpoint_url + "/" + voucher.journal.journalNumber.to_s + "/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

24 entries across 24 versions & 1 rubygems

Version Path
economic-rest-0.4.1 lib/economic/journal_voucher_repo.rb
economic-rest-0.4.0 lib/economic/journal_voucher_repo.rb
economic-rest-0.3.6 lib/economic/journal_voucher_repo.rb
economic-rest-0.3.5 lib/economic/journal_voucher_repo.rb