Module: Payme::RequestBinary

Defined in:
lib/payme/request/binary.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/payme/request/binary.rb', line 4

def self.included(klass)
  klass.class_eval do
    
    #
    # Executes the binary call, gets the datas
    # Validates that the the code is correct
    # And returns the form
    #
    def launch
      result = exec.split('!')
      
      raise Payme::Errors::MissingPath if result.empty? or (result[1].empty? && result[2].empty?)
      result
    end
    
    private
    #
    # Executes the binary call
    #
    def exec
      path = File.join(options[:bin_path], 'request')
      `#{path} #{parse_params}` || ''
    end
  end
end