Sha256: 5d573c598b46573d743ae6fd9ff96d1b09ab7c53c4e4d8dfa23382788c0b0589
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
module Squall # OnApp Payment class Payment < Base # Return a list of all payments def list(user_id) response = request(:get, "/users/#{user_id}/payments.json") response.collect { |user| user['payment'] } end # Create a payment for a user # # ==== Params # # * +user_id*+ - ID of the user # * +options+ - Params for creating the User # # ==== Options # # * +amount*+ - Amount of the payment # * +invoice_number+ - Number of the invoice # # ==== Example # # create :amount => 500, # :invoice_number => "01234", def create(user_id, options={}) params.required(:amount).accepts(:invoice_number).validate!(options) request(:post, "/users/#{user_id}/payments.json", default_params(options)) end # Edit a payment # # ==== Params # # * +user_id*+ - ID of the user # * +id*+ - ID of the payment # * +options+ - Params for editing the payment # # ==== Options # # See #create def edit(user_id, id, options={}) params.accepts(:amount, :invoice_number).validate!(options) request(:put, "/users/#{user_id}/payments/#{id}.json", default_params(options)) end # Delete a payment # # ==== Params # # * +user_id*+ - ID of the user # * +id*+ - ID of the payment def delete(user_id, id) request(:delete, "/users/#{user_id}/payments/#{id}.json") end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
squall-1.3.0 | lib/squall/payment.rb |
squall-1.2.1beta1 | lib/squall/payment.rb |
squall-1.2.0beta1 | lib/squall/payment.rb |
squall-1.1.0 | lib/squall/payment.rb |