Module: Culqi::List

Included in:
Card, Charge, Customer, Event, Iins, Order, Plan, Refund, Subscription, Token, Transfer
Defined in:
lib/operation/list.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



13
14
15
# File 'lib/operation/list.rb', line 13

def initialize
  @url = ''
end

#list(params = {}) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/operation/list.rb', line 17

def list(params={})
  error = verifyClassValidationList(@url, params)
  if error
    return error
  end
  response = Culqi.connect(@url, Culqi.secret_key, params, 'get', Culqi::LIST_TIMEOUT)
  return response
end

#verifyClassValidationList(url = '', params) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/operation/list.rb', line 26

def verifyClassValidationList(url='', params)
  begin
    if @url.include? 'token'
      TokenValidation.list(params)
    end

    if @url.include? 'charge'
      ChargeValidation.list(params)
    end
    
    if @url.include? 'card'
      CardValidation.list(params)
    end
    
    if @url.include? 'customer'
      CustomerValidation.list(params)
    end
    
    if @url.include? 'refund'
      RefundValidation.list(params)
    end
    
    if @url.include? 'plan'
      PlanValidation.list(params)
    end
    
    if @url.include? 'subscription'
      SubscriptionValidation.list(params)
    end
    
    if @url.include? 'order'
      OrderValidation.list(params)
    end
  rescue CustomException => e
    return e.message
  end
end