rapflag 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rapflag/poloniex.rb +4 -2
- data/lib/rapflag/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 975366d2f92d18c927b78a18a452960510828dcf
         | 
| 4 | 
            +
              data.tar.gz: 61227a8bb8dfc41d5e58ab07a2220118d6e2071b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 834e66a4a16d90139484e5b36dc85ee9d72961e6ab3fe2cd2f25320689fd0abd38e27eb1b7d6ae2799e38755f6791e4e79420f726f8c04bd2c6486c19a06f01c
         | 
| 7 | 
            +
              data.tar.gz: 64e75b4b80c10b2e0ff9a12c15bdb930a4f28d4ca601d5dc4722fe4a20695a55e37a3d7b665383f95ea0c6c615029e5490ee04b4177c6c40907c6a4bf9d1a664
         | 
    
        data/lib/rapflag/poloniex.rb
    CHANGED
    
    | @@ -272,12 +272,13 @@ module RAPFLAG | |
| 272 272 | 
             
                private
         | 
| 273 273 | 
             
                def load_or_save_json(name, param = nil)
         | 
| 274 274 | 
             
                  json_file = File.join(@spec_data, name.to_s + '.json')
         | 
| 275 | 
            -
                   | 
| 275 | 
            +
                  body = nil
         | 
| 276 | 
            +
                  if File.directory?(@spec_data) && File.exist?(json_file) && defined?(RSpec)
         | 
| 276 277 | 
             
                    body = IO.read(json_file)
         | 
| 277 278 | 
             
                  else
         | 
| 278 279 | 
             
                    cmd = param ? "::Poloniex.#{name.to_s}('#{param}').body" : "::Poloniex.#{name.to_s}.body"
         | 
| 279 280 | 
             
                    body = eval(cmd)
         | 
| 280 | 
            -
                    File.open(json_file, 'w+') { |f| f.write(body)}
         | 
| 281 | 
            +
                    File.open(json_file, 'w+') { |f| f.write(body)} if defined?(RSpec)
         | 
| 281 282 | 
             
                  end
         | 
| 282 283 | 
             
                  eval("@#{name} = JSON.parse(body)")
         | 
| 283 284 | 
             
                end
         | 
| @@ -289,6 +290,7 @@ module RAPFLAG | |
| 289 290 | 
             
                    puts "Error was #{error.inspect}"
         | 
| 290 291 | 
             
                    puts "Calling @balances from poloniex failed. Configuration was"
         | 
| 291 292 | 
             
                    pp ::Poloniex.configuration
         | 
| 293 | 
            +
                    puts "Backtrace #{error.backtrace.join("\n")}"
         | 
| 292 294 | 
             
                    exit 1
         | 
| 293 295 | 
             
                  end
         | 
| 294 296 | 
             
                  @active_loans = load_or_save_json(:active_loans)
         | 
    
        data/lib/rapflag/version.rb
    CHANGED