ckm_client 0.0.3 → 0.1.0
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/.travis.yml +1 -0
- data/Gemfile.lock +7 -7
- data/Guardfile +1 -1
- data/README.md +8 -1
- data/ckm_client.gemspec +3 -2
- data/features/step_definitions/{soap_interface.steps.rb → soap_interface_steps.rb} +2 -2
- data/lib/openehr/ckm_client/cli.rb +13 -4
- data/lib/openehr/ckm_client/soap_interface.rb +8 -3
- data/lib/openehr/ckm_client/version.rb +1 -1
- data/spec/openehr/ckm_client/cli_spec.rb +25 -0
- data/spec/openehr/ckm_client/soap_interface_spec.rb +22 -26
- data/spec/spec_helper.rb +0 -1
- metadata +10 -9
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 745d3473ee48d8d26b78481b893ca5ac5cd20cca
         | 
| 4 | 
            +
              data.tar.gz: cb136fa63ca8e598952b1bce03434e6c88638137
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8acfbf1d3c71825070b974afdd50638131ed08bdea990ecb19153fa563f0e7b448136cf7c87e3d20144f2ac6ec6c4755ca8be27bfe7490d26f994a32f936b11d
         | 
| 7 | 
            +
              data.tar.gz: 468211419f4e14f1b5d030688a8e7fc7229e790f32c4ffa5e4a2ca7c6de4ed31053eea893e5f18c1ad61ed534a505c0b462527ea5bac199ef6bf7c58746b08cf
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                ckm_client (0.0. | 
| 4 | 
            +
                ckm_client (0.0.3)
         | 
| 5 5 | 
             
                  soap4r-ruby1.9
         | 
| 6 6 | 
             
                  thor
         | 
| 7 7 |  | 
| 8 8 | 
             
            GEM
         | 
| 9 9 | 
             
              remote: https://rubygems.org/
         | 
| 10 10 | 
             
              specs:
         | 
| 11 | 
            -
                builder (3. | 
| 11 | 
            +
                builder (3.0.4)
         | 
| 12 12 | 
             
                childprocess (0.3.9)
         | 
| 13 13 | 
             
                  ffi (~> 1.0, >= 1.0.11)
         | 
| 14 14 | 
             
                coderay (1.0.9)
         | 
| @@ -18,7 +18,7 @@ GEM | |
| 18 18 | 
             
                  gherkin (~> 2.11.6)
         | 
| 19 19 | 
             
                  multi_json (~> 1.3)
         | 
| 20 20 | 
             
                diff-lcs (1.2.1)
         | 
| 21 | 
            -
                ffi (1. | 
| 21 | 
            +
                ffi (1.5.0)
         | 
| 22 22 | 
             
                gherkin (2.11.6)
         | 
| 23 23 | 
             
                  json (>= 1.7.6)
         | 
| 24 24 | 
             
                guard (1.6.2)
         | 
| @@ -30,7 +30,7 @@ GEM | |
| 30 30 | 
             
                guard-cucumber (1.3.2)
         | 
| 31 31 | 
             
                  cucumber (>= 1.2.0)
         | 
| 32 32 | 
             
                  guard (>= 1.1.0)
         | 
| 33 | 
            -
                guard-rspec (2. | 
| 33 | 
            +
                guard-rspec (2.5.1)
         | 
| 34 34 | 
             
                  guard (>= 1.1)
         | 
| 35 35 | 
             
                  rspec (~> 2.11)
         | 
| 36 36 | 
             
                guard-spork (1.5.0)
         | 
| @@ -41,7 +41,7 @@ GEM | |
| 41 41 | 
             
                libnotify (0.8.0)
         | 
| 42 42 | 
             
                  ffi (>= 1.0.11)
         | 
| 43 43 | 
             
                listen (0.6.0)
         | 
| 44 | 
            -
                lumberjack (1.0. | 
| 44 | 
            +
                lumberjack (1.0.3)
         | 
| 45 45 | 
             
                method_source (0.8.1)
         | 
| 46 46 | 
             
                multi_json (1.7.1)
         | 
| 47 47 | 
             
                pry (0.9.12)
         | 
| @@ -73,11 +73,11 @@ DEPENDENCIES | |
| 73 73 | 
             
              cucumber
         | 
| 74 74 | 
             
              guard
         | 
| 75 75 | 
             
              guard-cucumber
         | 
| 76 | 
            -
              guard-rspec | 
| 76 | 
            +
              guard-rspec
         | 
| 77 77 | 
             
              guard-spork
         | 
| 78 78 | 
             
              libnotify
         | 
| 79 79 | 
             
              listen (= 0.6)
         | 
| 80 80 | 
             
              rake
         | 
| 81 81 | 
             
              rb-kqueue
         | 
| 82 82 | 
             
              rspec
         | 
| 83 | 
            -
              spork (~> 1. | 
| 83 | 
            +
              spork (~> 1.0rc)
         | 
    
        data/Guardfile
    CHANGED
    
    | @@ -11,7 +11,7 @@ guard 'cucumber', cli: '--format progress --no-profile --drb' do | |
| 11 11 | 
             
              watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
         | 
| 12 12 | 
             
            end
         | 
| 13 13 |  | 
| 14 | 
            -
            guard 'rspec',  | 
| 14 | 
            +
            guard 'rspec', cli: '--drb --color' do
         | 
| 15 15 | 
             
              watch(%r{^spec/.+_spec\.rb$})
         | 
| 16 16 | 
             
              watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
         | 
| 17 17 | 
             
              watch('spec/spec_helper.rb')  { "spec" }
         | 
    
        data/README.md
    CHANGED
    
    | @@ -5,7 +5,14 @@ A client module for the openEHR clincal knowledge manager | |
| 5 5 |  | 
| 6 6 | 
             
            Usage
         | 
| 7 7 | 
             
            ----------
         | 
| 8 | 
            -
             | 
| 8 | 
            +
            Usage:
         | 
| 9 | 
            +
              ckmc <command> [<args>]
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            Commands supported:
         | 
| 12 | 
            +
              get    Retrieve archetype by archetype_id
         | 
| 13 | 
            +
              search   query archetype by keyword
         | 
| 14 | 
            +
              help     show this help
         | 
| 15 | 
            +
             | 
| 9 16 |  | 
| 10 17 | 
             
            Commands supported:
         | 
| 11 18 | 
             
              fetch    Retrieve archetype by archetype_id
         | 
    
        data/ckm_client.gemspec
    CHANGED
    
    | @@ -30,11 +30,12 @@ Gem::Specification.new do |gem| | |
| 30 30 | 
             
              gem.add_development_dependency('cucumber')
         | 
| 31 31 | 
             
              gem.add_development_dependency('guard')
         | 
| 32 32 | 
             
              gem.add_development_dependency('guard-spork')
         | 
| 33 | 
            -
              gem.add_development_dependency('spork', '~> 1. | 
| 34 | 
            -
              gem.add_development_dependency('guard-rspec' | 
| 33 | 
            +
              gem.add_development_dependency('spork', '~> 1.0rc')
         | 
| 34 | 
            +
              gem.add_development_dependency('guard-rspec')
         | 
| 35 35 | 
             
              gem.add_development_dependency('guard-cucumber')
         | 
| 36 36 | 
             
              gem.add_development_dependency('listen', '0.6')
         | 
| 37 37 | 
             
              gem.add_development_dependency('rb-kqueue')
         | 
| 38 | 
            +
            #  gem.add_development_dependency('ammeter', '0.2.8')
         | 
| 38 39 | 
             
              gem.add_development_dependency('libnotify')
         | 
| 39 40 | 
             
            end
         | 
| 40 41 |  | 
| @@ -29,11 +29,11 @@ end | |
| 29 29 |  | 
| 30 30 | 
             
            When /^I fetch adl file by archetype ID$/ do
         | 
| 31 31 | 
             
              si = OpenEHR::CKMClient::SOAPInterface.new
         | 
| 32 | 
            -
              @ | 
| 32 | 
            +
              @adl = si.fetch(@archetype_id)
         | 
| 33 33 | 
             
            end
         | 
| 34 34 |  | 
| 35 35 | 
             
            Then /^ID matched archetype should be retrieved$/ do
         | 
| 36 | 
            -
              @ | 
| 36 | 
            +
              @adl.should match /#{@ardchetype_id}/
         | 
| 37 37 | 
             
            end
         | 
| 38 38 |  | 
| 39 39 | 
             
            Given /^partial archetype ID$/ do
         | 
| @@ -4,16 +4,19 @@ require 'openehr/ckm_client/soap_interface' | |
| 4 4 | 
             
            module OpenEHR
         | 
| 5 5 | 
             
              module CKMClient
         | 
| 6 6 | 
             
                class CLI < Thor
         | 
| 7 | 
            -
                   | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 7 | 
            +
                  include Thor::Actions
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  desc 'get', 'Retrieve archetype by archetype_id'
         | 
| 10 | 
            +
                  def get(archetype_id)
         | 
| 11 | 
            +
                    create_file archetype_id+'.adl', soap_interface.fetch(archetype_id)
         | 
| 10 12 | 
             
                  end
         | 
| 11 13 |  | 
| 14 | 
            +
                  desc 'fetch', 'alias of get'
         | 
| 12 15 | 
             
                  alias fetch get
         | 
| 13 16 |  | 
| 14 17 | 
             
                  desc 'search', 'Query archetype by partial id'
         | 
| 15 18 | 
             
                  def search(part_id)
         | 
| 16 | 
            -
                    puts  | 
| 19 | 
            +
                    puts soap_interface.new.search(part_id)
         | 
| 17 20 | 
             
                  end
         | 
| 18 21 |  | 
| 19 22 | 
             
                  desc 'help', 'Show  this help'
         | 
| @@ -28,6 +31,12 @@ Commands supported: | |
| 28 31 | 
             
              help     show this help
         | 
| 29 32 | 
             
            USAGE
         | 
| 30 33 | 
             
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  private
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  def soap_interface
         | 
| 38 | 
            +
                    OpenEHR::CKMClient::SOAPInterface.new
         | 
| 39 | 
            +
                  end
         | 
| 31 40 | 
             
                end
         | 
| 32 41 | 
             
              end
         | 
| 33 42 | 
             
            end
         | 
| @@ -11,11 +11,16 @@ module OpenEHR | |
| 11 11 | 
             
                  end
         | 
| 12 12 |  | 
| 13 13 | 
             
                  def fetch(id)
         | 
| 14 | 
            -
                     | 
| 14 | 
            +
                    soap_driver(@repository).get_adl_by_id(id)
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 17 | 
             
                  def search(partial_id)
         | 
| 18 | 
            -
                     | 
| 18 | 
            +
                    soap_driver(@repository).get_archetypes_by_partial_id(partial_id)
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  private
         | 
| 22 | 
            +
                  def soap_driver(repository)
         | 
| 23 | 
            +
                    SOAPDriver.new(repository)
         | 
| 19 24 | 
             
                  end
         | 
| 20 25 | 
             
                end
         | 
| 21 26 |  | 
| @@ -28,7 +33,7 @@ module OpenEHR | |
| 28 33 | 
             
                    @driver.getArchetypeInADL(archetypeId: id).m_return
         | 
| 29 34 | 
             
                  end
         | 
| 30 35 |  | 
| 31 | 
            -
                  def get_archetypes_by_partial_id(id)
         | 
| 36 | 
            +
                  def get_archetypes_by_partial_id(id) 
         | 
| 32 37 | 
             
                    @driver.getArchetypeIdsFromPartialId(archetypeIdPart: id).m_return
         | 
| 33 38 | 
             
                  end
         | 
| 34 39 | 
             
                end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe OpenEHR::CKMClient::CLI do
         | 
| 4 | 
            +
              let(:ckmc) { OpenEHR::CKMClient::CLI.new }
         | 
| 5 | 
            +
              let(:archetype_id) { 'openEHR-EHR-OBSERVATION.blood_match' }
         | 
| 6 | 
            +
              let(:target_file) { archetype_id + '.adl' }
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              describe "#get" do
         | 
| 9 | 
            +
                it 'should get archetype from repository' do
         | 
| 10 | 
            +
                  ckmc.get archetype_id
         | 
| 11 | 
            +
                  expect { File.exists?(target_file)}.to be_true
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                after do
         | 
| 15 | 
            +
                  File.delete target_file
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              describe '#help' do
         | 
| 20 | 
            +
                it 'call help' do
         | 
| 21 | 
            +
                  
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
             | 
| @@ -1,37 +1,33 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 3 | 
            +
            describe OpenEHR::CKMClient::SOAPInterface do
         | 
| 4 | 
            +
              let(:repository) { 'http://www.openehr.org/' }
         | 
| 5 | 
            +
              let(:openehr_repository) { 'http://openehr.org/ckm/services/ArchetypeFinderBean?wsdl' }
         | 
| 6 | 
            +
              let(:archetype_id){ 'openEHR-EHR-OBSERVATION.blood_pressure.v1' }
         | 
| 6 7 |  | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
                  describe "#initialize" do
         | 
| 11 | 
            -
                    context 'repository is assigned as constructor parameter' do
         | 
| 12 | 
            -
                      let(:si) { OpenEHR::CKMClient::SOAPInterface.new(REPOSITORY) }
         | 
| 13 | 
            -
                      
         | 
| 14 | 
            -
                      it 'respoistory is REPOSITORY' do
         | 
| 15 | 
            -
                        si.repository.should == REPOSITORY
         | 
| 16 | 
            -
                      end
         | 
| 17 | 
            -
                    end
         | 
| 8 | 
            +
              describe "#initialize" do
         | 
| 9 | 
            +
                context 'repository is assigned as constructor parameter' do
         | 
| 10 | 
            +
                  let(:si) { OpenEHR::CKMClient::SOAPInterface.new(repository) }
         | 
| 18 11 |  | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                      
         | 
| 22 | 
            -
                      it 'default repository is openEHR ckm repository' do
         | 
| 23 | 
            -
                        si.repository.should == OPENEHR_REPOSITORY
         | 
| 24 | 
            -
                      end
         | 
| 25 | 
            -
                    end
         | 
| 12 | 
            +
                  it 'respoistory is repository' do
         | 
| 13 | 
            +
                    si.repository.should == repository
         | 
| 26 14 | 
             
                  end
         | 
| 15 | 
            +
                end
         | 
| 27 16 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 17 | 
            +
                context 'Default repository is openEHR CKM repository' do
         | 
| 18 | 
            +
                  let(:si) { OpenEHR::CKMClient::SOAPInterface.new }
         | 
| 30 19 |  | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
                    end
         | 
| 20 | 
            +
                  it 'default repository is openEHR ckm repository' do
         | 
| 21 | 
            +
                    si.repository.should == openehr_repository
         | 
| 34 22 | 
             
                  end
         | 
| 35 23 | 
             
                end
         | 
| 36 24 | 
             
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              describe "#fetch" do
         | 
| 27 | 
            +
                let(:si) { OpenEHR::CKMClient::SOAPInterface.new }
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                it 'fetch archetype by id' do
         | 
| 30 | 
            +
                  si.fetch(archetype_id).should match /#{archetype_id}/
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
              end
         | 
| 37 33 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ckm_client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0 | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Shinji KOBAYASHI
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2013-03- | 
| 11 | 
            +
            date: 2013-03-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: thor
         | 
| @@ -114,28 +114,28 @@ dependencies: | |
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - ~>
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: 1. | 
| 117 | 
            +
                    version: 1.0rc
         | 
| 118 118 | 
             
              type: :development
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 121 | 
             
                requirements:
         | 
| 122 122 | 
             
                - - ~>
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: 1. | 
| 124 | 
            +
                    version: 1.0rc
         | 
| 125 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 126 | 
             
              name: guard-rspec
         | 
| 127 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 128 | 
             
                requirements:
         | 
| 129 | 
            -
                - -  | 
| 129 | 
            +
                - - '>='
         | 
| 130 130 | 
             
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            -
                    version:  | 
| 131 | 
            +
                    version: '0'
         | 
| 132 132 | 
             
              type: :development
         | 
| 133 133 | 
             
              prerelease: false
         | 
| 134 134 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 135 | 
             
                requirements:
         | 
| 136 | 
            -
                - -  | 
| 136 | 
            +
                - - '>='
         | 
| 137 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            -
                    version:  | 
| 138 | 
            +
                    version: '0'
         | 
| 139 139 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 140 140 | 
             
              name: guard-cucumber
         | 
| 141 141 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -213,13 +213,14 @@ files: | |
| 213 213 | 
             
            - bin/ckmc
         | 
| 214 214 | 
             
            - ckm_client.gemspec
         | 
| 215 215 | 
             
            - features/soap_interface.feature
         | 
| 216 | 
            -
            - features/step_definitions/ | 
| 216 | 
            +
            - features/step_definitions/soap_interface_steps.rb
         | 
| 217 217 | 
             
            - features/support/env.rb
         | 
| 218 218 | 
             
            - lib/openehr.rb
         | 
| 219 219 | 
             
            - lib/openehr/ckm_client.rb
         | 
| 220 220 | 
             
            - lib/openehr/ckm_client/cli.rb
         | 
| 221 221 | 
             
            - lib/openehr/ckm_client/soap_interface.rb
         | 
| 222 222 | 
             
            - lib/openehr/ckm_client/version.rb
         | 
| 223 | 
            +
            - spec/openehr/ckm_client/cli_spec.rb
         | 
| 223 224 | 
             
            - spec/openehr/ckm_client/soap_interface_spec.rb
         | 
| 224 225 | 
             
            - spec/spec_helper.rb
         | 
| 225 226 | 
             
            homepage: http://openehr.jp
         |