fit_parser 1.0.0 → 1.0.1
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/fit_parser/file.rb +6 -1
- data/lib/fit_parser/version.rb +1 -1
- data/spec/fit_parser_spec.rb +49 -0
- data/spec/support/examples/file/598363e9-3121-4f24-8b6f-b1368a269e8f. +0 -0
- data/spec/support/examples/file/7348726805 +0 -0
- data/spec/support/examples/file/7420309810 +0 -0
- data/spec/support/examples/file/7439451200 +0 -0
- data/spec/support/examples/file/7edbeca2-0c62-42b6-9e7a-e869b1e5ccd0. +0 -0
- data/spec/support/examples/file/dbcdf1a1-3ce0-4e71-a409-bec64c6043b0. +0 -0
- data/spec/support/examples/file/f334a45f-cd2b-40d8-9c46-b4c34fe9e9dd. +0 -0
- data/spec/support/examples/file/fcc17445-79ec-43bc-9f7f-ea9324992cd2. +0 -0
- metadata +10 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 72ce3efaec7485edeaed99cf287affb05e8b8922
         | 
| 4 | 
            +
              data.tar.gz: f264feeda86713b7e7f0c587cd60776001f1a852
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ad5ef11cbe70f2aef8f771c25f3185e237e320958a38f624263cedb719bf89c67d6df447878d1d90a6abaa4a73a425c5e2b5c211a008f60539ab921526166a01
         | 
| 7 | 
            +
              data.tar.gz: a4c342fbf692ed3b8ce12c16bca636269ed85dd8d9df362936b375d0724ea4488811c5c87e5ced0cfb2ddcab5fd3a907517913ebfd118d75ee9d782e6ae46419
         | 
    
        data/lib/fit_parser/file.rb
    CHANGED
    
    | @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            module FitParser
         | 
| 2 2 | 
             
              class File
         | 
| 3 | 
            +
                MSG_NUM_FIELD_DESCRIPTION = 206
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
                def self.read(io)
         | 
| 4 6 | 
             
                  new.read(io)
         | 
| 5 7 | 
             
                end
         | 
| @@ -18,7 +20,10 @@ module FitParser | |
| 18 20 | 
             
                    record = Record.new(definitions, dev_definitions)
         | 
| 19 21 | 
             
                    @records << record.read(io)
         | 
| 20 22 | 
             
                    content = record.content
         | 
| 21 | 
            -
                    if content[: | 
| 23 | 
            +
                    if content[:global_message_number] == MSG_NUM_FIELD_DESCRIPTION
         | 
| 24 | 
            +
                      field_definition_local_message_type = record.header.local_message_type
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
                    if !content[:global_message_number] && field_definition_local_message_type && record.header.local_message_type == field_definition_local_message_type
         | 
| 22 27 | 
             
                      dev_definitions[content[:raw_field_0].to_s] ||= {}
         | 
| 23 28 | 
             
                      dev_definitions[content[:raw_field_0].to_s][content[:raw_field_1].to_s] = content
         | 
| 24 29 | 
             
                    end
         | 
    
        data/lib/fit_parser/version.rb
    CHANGED
    
    
    
        data/spec/fit_parser_spec.rb
    CHANGED
    
    | @@ -33,6 +33,24 @@ describe FitParser do | |
| 33 33 | 
             
                  end
         | 
| 34 34 | 
             
                  threads.each { |thread| thread.join }
         | 
| 35 35 | 
             
                end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                # sometimes doesn't work because of multithreads issues
         | 
| 38 | 
            +
                # it 'works with threads' do
         | 
| 39 | 
            +
                #   threads = []
         | 
| 40 | 
            +
                #   %w(
         | 
| 41 | 
            +
                #     f334a45f-cd2b-40d8-9c46-b4c34fe9e9dd.
         | 
| 42 | 
            +
                #     598363e9-3121-4f24-8b6f-b1368a269e8f.
         | 
| 43 | 
            +
                #     7edbeca2-0c62-42b6-9e7a-e869b1e5ccd0.
         | 
| 44 | 
            +
                #     dbcdf1a1-3ce0-4e71-a409-bec64c6043b0.
         | 
| 45 | 
            +
                #     fcc17445-79ec-43bc-9f7f-ea9324992cd2.
         | 
| 46 | 
            +
                #     ).each do |file|
         | 
| 47 | 
            +
                #     threads << Thread.new(file) do |el|
         | 
| 48 | 
            +
                #       data = FitParser.load_file("spec/support/examples/file/#{el}")
         | 
| 49 | 
            +
                #       expect(data.records).to_not be_nil
         | 
| 50 | 
            +
                #     end
         | 
| 51 | 
            +
                #   end
         | 
| 52 | 
            +
                #   threads.each { |thread| thread.join }
         | 
| 53 | 
            +
                # end
         | 
| 36 54 | 
             
              end
         | 
| 37 55 |  | 
| 38 56 | 
             
              it 'works without threads' do
         | 
| @@ -66,4 +84,35 @@ describe FitParser do | |
| 66 84 | 
             
                  expect(data.records).to_not be_nil
         | 
| 67 85 | 
             
                end
         | 
| 68 86 | 
             
              end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
              it 'works' do
         | 
| 89 | 
            +
                %w(
         | 
| 90 | 
            +
                  f334a45f-cd2b-40d8-9c46-b4c34fe9e9dd.
         | 
| 91 | 
            +
                  598363e9-3121-4f24-8b6f-b1368a269e8f.
         | 
| 92 | 
            +
                  7edbeca2-0c62-42b6-9e7a-e869b1e5ccd0.
         | 
| 93 | 
            +
                  dbcdf1a1-3ce0-4e71-a409-bec64c6043b0.
         | 
| 94 | 
            +
                  fcc17445-79ec-43bc-9f7f-ea9324992cd2.
         | 
| 95 | 
            +
                ).each do |el|
         | 
| 96 | 
            +
                  data = FitParser.load_file("spec/support/examples/file/#{el}")
         | 
| 97 | 
            +
                  expect(data.records).to_not be_nil
         | 
| 98 | 
            +
                end
         | 
| 99 | 
            +
              end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
              it 'works 7439451200' do
         | 
| 102 | 
            +
                path = 'spec/support/examples/file/7439451200'
         | 
| 103 | 
            +
                data = FitParser.load_file(path)
         | 
| 104 | 
            +
                expect(data.records).to_not be_nil
         | 
| 105 | 
            +
              end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
              it 'works 7420309810' do
         | 
| 108 | 
            +
                path = 'spec/support/examples/file/7420309810'
         | 
| 109 | 
            +
                data = FitParser.load_file(path)
         | 
| 110 | 
            +
                expect(data.records).to_not be_nil
         | 
| 111 | 
            +
              end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
              it 'works 7348726805' do
         | 
| 114 | 
            +
                path = 'spec/support/examples/file/7348726805'
         | 
| 115 | 
            +
                data = FitParser.load_file(path)
         | 
| 116 | 
            +
                expect(data.records).to_not be_nil
         | 
| 117 | 
            +
              end
         | 
| 69 118 | 
             
            end
         | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: fit_parser
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Dima Mescheryakov
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-11- | 
| 11 | 
            +
            date: 2016-11-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bindata
         | 
| @@ -172,8 +172,16 @@ files: | |
| 172 172 | 
             
            - spec/support/examples/6AUI5200.FIT
         | 
| 173 173 | 
             
            - spec/support/examples/file/3110334490
         | 
| 174 174 | 
             
            - spec/support/examples/file/3863374146
         | 
| 175 | 
            +
            - spec/support/examples/file/598363e9-3121-4f24-8b6f-b1368a269e8f.
         | 
| 176 | 
            +
            - spec/support/examples/file/7348726805
         | 
| 177 | 
            +
            - spec/support/examples/file/7420309810
         | 
| 178 | 
            +
            - spec/support/examples/file/7439451200
         | 
| 179 | 
            +
            - spec/support/examples/file/7edbeca2-0c62-42b6-9e7a-e869b1e5ccd0.
         | 
| 175 180 | 
             
            - spec/support/examples/file/be470628-c34a-4189-aae3-42bef36436ce.fit
         | 
| 181 | 
            +
            - spec/support/examples/file/dbcdf1a1-3ce0-4e71-a409-bec64c6043b0.
         | 
| 182 | 
            +
            - spec/support/examples/file/f334a45f-cd2b-40d8-9c46-b4c34fe9e9dd.
         | 
| 176 183 | 
             
            - spec/support/examples/file/fc84b277-68af-4d63-ac8d-fb8e162ab2a2.fit
         | 
| 184 | 
            +
            - spec/support/examples/file/fcc17445-79ec-43bc-9f7f-ea9324992cd2.
         | 
| 177 185 | 
             
            - spec/support/examples/file/full_file_with_wrong_crc.fit
         | 
| 178 186 | 
             
            - spec/support/examples/file/header
         | 
| 179 187 | 
             
            - spec/support/examples/file/header_14b.fit
         |