Class: Adyen::Service
- Inherits:
-
Object
- Object
- Adyen::Service
- Defined in:
- lib/adyen/services/service.rb
Direct Known Subclasses
BinLookup, Checkout, CheckoutDetail, CheckoutUtility, DataProtection, Dispute, Marketpay::Account, Marketpay::Fund, Marketpay::Hop, Marketpay::Notification, Payments, Payouts, PosTerminalManagement, Recurring
Instance Attribute Summary collapse
-
#service ⇒ Object
Returns the value of attribute service.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
-
.action_for_method_name(method_name) ⇒ Object
add snake case to camel case converter to String to convert rubinic method names to Adyen API methods.
Instance Method Summary collapse
-
#initialize(client, version, service, method_names, with_application_info = []) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(client, version, service, method_names, with_application_info = []) ⇒ Service
Returns a new instance of Service.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/adyen/services/service.rb', line 14 def initialize(client, version, service, method_names, with_application_info = []) @client = client @version = version @service = service # dynamically create API methods method_names.each do |method_name| define_singleton_method method_name do |request, headers = {}| action = self.class.action_for_method_name(method_name) @client.call_adyen_api(@service, action, request, headers, @version, with_application_info.include?(method_name)) end end end |
Instance Attribute Details
#service ⇒ Object
Returns the value of attribute service.
3 4 5 |
# File 'lib/adyen/services/service.rb', line 3 def service @service end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/adyen/services/service.rb', line 3 def version @version end |
Class Method Details
.action_for_method_name(method_name) ⇒ Object
add snake case to camel case converter to String to convert rubinic method names to Adyen API methods
i.e. snake_case -> snakeCase note that the first letter is not capitalized as normal
10 11 12 |
# File 'lib/adyen/services/service.rb', line 10 def self.action_for_method_name(method_name) method_name.to_s.gsub(/_./) { |x| x[1].upcase } end |