Created
          April 9, 2013 15:38 
        
      - 
      
- 
        Save demental/5346723 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Foo | |
| METHODE_NAMES = ['problems', 'maintenances', 'journeys'] | |
| class << self | |
| def get_var(name, hsh) | |
| ApiRequest.new(params: {account_id: hsh[:email], vin: hsh[:vin]}, | |
| url: "vehicles/#{hsh[:vin]}/#{name}", verb: "get").get | |
| end | |
| METHODE_NAMES.each do name | |
| class_eval <<-METHODS, __FILE__, __LINE__ | |
| def self.get_#{name}(hsh = {}) | |
| get_var(name, hsh) | |
| end | |
| METHODS | |
| end | |
| end | 
        
      
            mcansky
  
      
      
      commented 
        Apr 9, 2013 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment