Module: BraintreeLyre::TransparentRedirect

Extended by:
Helpers
Defined in:
lib/braintree_lyre/transparent_redirect.rb,
lib/braintree_lyre/transparent_redirect/create_transaction.rb

Defined Under Namespace

Classes: CreateTransaction

Class Method Summary collapse

Methods included from Helpers

camelize, constantize, gzip, gzipped_response

Class Method Details

.create(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/braintree_lyre/transparent_redirect.rb', line 10

def self.create(params)
  matches = params['tr_data'].match(/
    ^                 #start at the beginning
    .*                #match anything
    &kind=            #match the key we are looking for
    (?<kind>[^&]+)    #match the value and name it type
    &                 #match the terminating ampersand
    .*                #match anything
    $                 #match to the end
  /x)

  kind = matches['kind']
  klass = kind_to_class(kind)

  klass.new(params)
end