Sha256: a8f03fddf6aa3cc54110847360ff19c57dd0e5bebfc75fa3169647453f18454d
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module TransferWise class APIResource include TransferWise::TransferWiseObject def self.class_name self.name.split('::')[-1] end def self.resource_url(resource_id) "#{collection_url}/#{resource_id}" end def self.collection_url if self == APIResource raise NotImplementedError.new('APIResource is an abstract class. You should perform actions on its subclasses (Account, Transfer, etc.)') end "/v1/#{CGI.escape(class_name.downcase)}s" end def self.create(params={}, opts={}) response = TransferWise::Request.request(:post, collection_url, params, opts) convert_to_transfer_wise_object(response) end def self.list(filters = {}, headers = {}) response = TransferWise::Request.request(:get, collection_url, filters, headers) convert_to_transfer_wise_object(response) end def self.get(resource_id, headers = {}) response = TransferWise::Request.request(:get, resource_url(resource_id), {}, headers) convert_to_transfer_wise_object(response) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transfer_wise-0.1.5 | lib/transfer_wise/api_resource.rb |
transfer_wise-0.1.4 | lib/transfer_wise/api_resource.rb |