class Omise::Customer

Public Class Methods

create(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 22
def self.create(attributes = {})
  new resource(location, attributes).post(attributes)
end
list(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 18
def self.list(attributes = {})
  List.new resource(location, attributes).get(attributes)
end
retrieve(id = nil, attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 14
def self.retrieve(id = nil, attributes = {})
  new resource(location(id), attributes).get(attributes)
end

Public Instance Methods

cards(options = {}) click to toggle source
# File lib/omise/customer.rb, line 54
def cards(options = {})
  if options.empty?
    list_attribute CardList, "cards"
  else
    response = collection.resource(location("cards")).get(options)
    CardList.new(response, parent: self)
  end
end
charge(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 42
def charge(attributes = {})
  if !defined?(Charge)
    require "omise/charge"
  end

  Charge.create(attributes.merge(customer: id))
end
default_card(options = {}) click to toggle source
# File lib/omise/customer.rb, line 50
def default_card(options = {})
  expand_attribute cards, "default_card", options
end
destroy(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 34
def destroy(attributes = {})
  assign_attributes resource(attributes).delete
end
reload(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 26
def reload(attributes = {})
  assign_attributes resource(attributes).get(attributes)
end
schedules(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 38
def schedules(attributes = {})
  List.new nested_resource("schedules", attributes).get(attributes)
end
update(attributes = {}) click to toggle source
# File lib/omise/customer.rb, line 30
def update(attributes = {})
  assign_attributes resource(attributes).patch(attributes)
end