class Cards

Public Class Methods

create(options={}) click to toggle source
# File lib/Cards.rb, line 29
def Cards.create(options={})
  if (options.length == 0)
    raise InvalidArguementError.new()
  end

  method = 'POST'
  url = '/card/add'
  response = request(method,url,options)
  card = Card.new(response.body)
  return card
end
delete(options={}) click to toggle source
# File lib/Cards.rb, line 60
def Cards.delete(options={})
  card_token = get_arg(options,:card_token)
  if card_token == NIL or card_token == ''
    raise InvalidArguementError.new("ERROR: `card_token` is a required parameter for Card.delete().")
  end

  method = 'POST'
  url = '/card/delete'
  response = request(method,url,options)
  card = Card.new(response.body)
  return card
end
list(options={}) click to toggle source
# File lib/Cards.rb, line 41
def Cards.list(options={})
  customer_id = get_arg(options,:customer_id)
  if customer_id == NIL or customer_id == ''
    raise InvalidArguementError.new("ERROR: `customer_id` is a required parameter for Cards.list().")
  end

  method = 'GET'
  url = '/card/list'
  response = Array(request(method,url,options).body['cards'])
  cards = []
  i=0
  while i != response.count
    card = Card.new(response[i])
    cards.push(card)
    i+=1
  end
  return cards
end