Module: Spreedly::Urls

Included in:
Environment
Defined in:
lib/spreedly/urls.rb

Instance Method Summary collapse

Instance Method Details

#add_gateway_urlObject



97
98
99
# File 'lib/spreedly/urls.rb', line 97

def add_gateway_url
  "#{base_url}/v1/gateways.xml"
end

#add_payment_method_urlObject



113
114
115
# File 'lib/spreedly/urls.rb', line 113

def add_payment_method_url
  "#{base_url}/v1/payment_methods.xml"
end

#add_receiver_urlObject



105
106
107
# File 'lib/spreedly/urls.rb', line 105

def add_receiver_url
  "#{base_url}/v1/receivers.xml"
end

#authorize_url(gateway_token) ⇒ Object



27
28
29
# File 'lib/spreedly/urls.rb', line 27

def authorize_url(gateway_token)
  "#{base_url}/v1/gateways/#{gateway_token}/authorize.xml"
end

#capture_url(authorization_token) ⇒ Object



35
36
37
# File 'lib/spreedly/urls.rb', line 35

def capture_url(authorization_token)
  "#{base_url}/v1/transactions/#{authorization_token}/capture.xml"
end

#complete_transaction_url(token) ⇒ Object



15
16
17
# File 'lib/spreedly/urls.rb', line 15

def complete_transaction_url(token)
  "#{base_url}/v1/transactions/#{token}/complete.xml"
end

#deliver_to_receiver_url(receiver_token) ⇒ Object



121
122
123
# File 'lib/spreedly/urls.rb', line 121

def deliver_to_receiver_url(receiver_token)
  "#{base_url}/v1/receivers/#{receiver_token}/deliver.xml"
end

#find_gateway_url(token) ⇒ Object



19
20
21
# File 'lib/spreedly/urls.rb', line 19

def find_gateway_url(token)
  "#{base_url}/v1/gateways/#{token}.xml"
end

#find_payment_method_url(token) ⇒ Object



3
4
5
# File 'lib/spreedly/urls.rb', line 3

def find_payment_method_url(token)
  "#{base_url}/v1/payment_methods/#{token}.xml"
end

#find_transaction_url(token) ⇒ Object



7
8
9
# File 'lib/spreedly/urls.rb', line 7

def find_transaction_url(token)
  "#{base_url}/v1/transactions/#{token}.xml"
end

#find_transcript_url(transaction_token) ⇒ Object



11
12
13
# File 'lib/spreedly/urls.rb', line 11

def find_transcript_url(transaction_token)
  "#{base_url}/v1/transactions/#{transaction_token}/transcript"
end

#gateway_options_urlObject



93
94
95
# File 'lib/spreedly/urls.rb', line 93

def gateway_options_url
  "#{base_url}/v1/gateways_options.xml"
end

#list_gateways_url(since_token) ⇒ Object



88
89
90
91
# File 'lib/spreedly/urls.rb', line 88

def list_gateways_url(since_token)
  since_param = "?since_token=#{since_token}" if since_token
  "#{base_url}/v1/gateways.xml#{since_param}"
end

#list_payment_methods_url(since_token) ⇒ Object



83
84
85
86
# File 'lib/spreedly/urls.rb', line 83

def list_payment_methods_url(since_token)
  since_param = "?since_token=#{since_token}" if since_token
  "#{base_url}/v1/payment_methods.xml#{since_param}"
end

#list_transactions_url(since_token, payment_method_token, options = {}) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/spreedly/urls.rb', line 67

def list_transactions_url(since_token, payment_method_token, options = {})
  options.each do |key, val|
    options[key.to_sym] = val
  end

  params = []
  params << "since_token=#{since_token}" if since_token
  params << "count=#{options[:count]}" if options[:count]
  params << "order=#{options[:order]}" if options[:order]
  params << "state=#{options[:state]}" if options[:state]
  param_string = "?#{params.join('&')}" if params.any?
  return "#{base_url}/v1/transactions.xml#{param_string}" unless payment_method_token

  "#{base_url}/v1/payment_methods/#{payment_method_token}/transactions.xml#{param_string}"
end

#purchase_url(gateway_token) ⇒ Object



23
24
25
# File 'lib/spreedly/urls.rb', line 23

def purchase_url(gateway_token)
  "#{base_url}/v1/gateways/#{gateway_token}/purchase.xml"
end

#recache_payment_method_url(payment_method_token) ⇒ Object



55
56
57
# File 'lib/spreedly/urls.rb', line 55

def recache_payment_method_url(payment_method_token)
  "#{base_url}/v1/payment_methods/#{payment_method_token}/recache.xml"
end

#receiver_options_urlObject



101
102
103
# File 'lib/spreedly/urls.rb', line 101

def receiver_options_url
  "#{base_url}/v1/receivers_options.xml"
end

#redact_gateway_url(gateway_token) ⇒ Object



59
60
61
# File 'lib/spreedly/urls.rb', line 59

def redact_gateway_url(gateway_token)
  "#{base_url}/v1/gateways/#{gateway_token}/redact.xml"
end

#redact_payment_method_url(payment_method_token) ⇒ Object



51
52
53
# File 'lib/spreedly/urls.rb', line 51

def redact_payment_method_url(payment_method_token)
  "#{base_url}/v1/payment_methods/#{payment_method_token}/redact.xml"
end

#redact_receiver_url(token) ⇒ Object



109
110
111
# File 'lib/spreedly/urls.rb', line 109

def redact_receiver_url(token)
  "#{base_url}/v1/receivers/#{token}/redact.xml"
end

#refund_transaction_url(token) ⇒ Object



43
44
45
# File 'lib/spreedly/urls.rb', line 43

def refund_transaction_url(token)
  "#{base_url}/v1/transactions/#{token}/credit.xml"
end

#retain_payment_method_url(payment_method_token) ⇒ Object



47
48
49
# File 'lib/spreedly/urls.rb', line 47

def retain_payment_method_url(payment_method_token)
  "#{base_url}/v1/payment_methods/#{payment_method_token}/retain.xml"
end

#store_url(gateway_token) ⇒ Object



63
64
65
# File 'lib/spreedly/urls.rb', line 63

def store_url(gateway_token)
  "#{base_url}/v1/gateways/#{gateway_token}/store.xml"
end

#update_payment_method_url(token) ⇒ Object



117
118
119
# File 'lib/spreedly/urls.rb', line 117

def update_payment_method_url(token)
  "#{base_url}/v1/payment_methods/#{token}.xml"
end

#verify_url(gateway_token) ⇒ Object



31
32
33
# File 'lib/spreedly/urls.rb', line 31

def verify_url(gateway_token)
  "#{base_url}/v1/gateways/#{gateway_token}/verify.xml"
end

#void_transaction_url(token) ⇒ Object



39
40
41
# File 'lib/spreedly/urls.rb', line 39

def void_transaction_url(token)
  "#{base_url}/v1/transactions/#{token}/void.xml"
end