Sha256: 8fe68575b9c72b3e306d52189c7caf3eefa7256fa380730cf421666a9139776c

Contents?: true

Size: 500 Bytes

Versions: 3

Compression:

Stored size: 500 Bytes

Contents

module Economic
  class JournalVoucherRepo < Economic::BaseRepo
    def self.save(voucher)
      response = RestClient.post(
        URI.escape(Economic::JournalRepo.endpoint_url + '/' + voucher.journal.journalNumber.to_s + '/vouchers'),
        voucher.to_h.to_json,
        headers
      )

      test_response(response)

      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

3 entries across 3 versions & 1 rubygems

Version Path
economic-rest-0.3.4 lib/economic/journal_voucher_repo.rb
economic-rest-0.3.3 lib/economic/journal_voucher_repo.rb
economic-rest-0.3.2 lib/economic/journal_voucher_repo.rb