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.5.14 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.13 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.12 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.11 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.10 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.9 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.8 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.7 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.6 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.5 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.4 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.3 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.2 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.1 lib/economic/journal_voucher_repo.rb
economic-rest-0.5.0 lib/economic/journal_voucher_repo.rb
economic-rest-0.4.7 lib/economic/journal_voucher_repo.rb
economic-rest-0.4.6 lib/economic/journal_voucher_repo.rb
economic-rest-0.4.4 lib/economic/journal_voucher_repo.rb
economic-rest-0.4.3 lib/economic/journal_voucher_repo.rb
economic-rest-0.4.2 lib/economic/journal_voucher_repo.rb