class Promisepay::FeeResource

Resource for the Fees API

Public Instance Methods

create(attributes) click to toggle source

Create a fee for a marketplace

@see reference.promisepay.com/#create-fee

@param attributes [Hash] Item's attributes.

@return [Promisepay::Item]

# File lib/promisepay/resources/fee_resource.rb, line 42
def create(attributes)
  response = JSON.parse(@client.post('fees', attributes).body)
  Promisepay::Fee.new(@client, response['fees'])
end
find(id) click to toggle source

Get a single fee for a marketplace

@see reference.promisepay.com/#show-fee

@param id [String] Marketplace Fee ID.

@return [Promisepay::Fee]

# File lib/promisepay/resources/fee_resource.rb, line 30
def find(id)
  response = JSON.parse(@client.get("fees/#{id}").body)
  Promisepay::Fee.new(@client, response['fees'])
end
find_all(options = {}) click to toggle source

List all fees for a marketplace

@see reference.promisepay.com/#list-fees

@param options [Hash] Optional options. @option options [Integer] :limit Can ask for up to 200 fees. default: 10 @option options [Integer] :offset Pagination help. default: 0

@return [Array<Promisepay::Fee>] List all fees for a marketplace.

# File lib/promisepay/resources/fee_resource.rb, line 17
def find_all(options = {})
  response = JSON.parse(@client.get('fees', options).body)
  fees = response.key?('fees') ? response['fees'] : []
  fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }
end
model() click to toggle source
# File lib/promisepay/resources/fee_resource.rb, line 4
def model
  Promisepay::Fee
end