collective-data 0.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.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Keith Gaddis
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = collective-data
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Keith Gaddis. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,64 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "collective-data"
8
+ gem.summary = %Q{This gem allows access to the data portal of CollectiveData from ruby.}
9
+ gem.description = %Q{This gem allows access to the data portal of CollectiveData from ruby.}
10
+ gem.email = "keith@collectiveidea.com"
11
+ gem.homepage = "http://github.com/collectiveidea/collective-data"
12
+ gem.authors = ["Keith Gaddis"]
13
+ gem.add_development_dependency "cucumber", ">= 0"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/test_*.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ begin
44
+ require 'cucumber/rake/task'
45
+ Cucumber::Rake::Task.new(:features)
46
+
47
+ task :features => :check_dependencies
48
+ rescue LoadError
49
+ task :features do
50
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
51
+ end
52
+ end
53
+
54
+ task :default => :test
55
+
56
+ require 'rake/rdoctask'
57
+ Rake::RDocTask.new do |rdoc|
58
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
59
+
60
+ rdoc.rdoc_dir = 'rdoc'
61
+ rdoc.title = "collective-data #{version}"
62
+ rdoc.rdoc_files.include('README*')
63
+ rdoc.rdoc_files.include('lib/**/*.rb')
64
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/cucumber.yml ADDED
@@ -0,0 +1,10 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
5
+ %>
6
+ default: -r features/step_definitions -r features/support <%= std_opts %>
7
+ pretty: -r features/step_definitions -r features/support --format pretty
8
+ wip: --tags @wip:3 --wip features
9
+ all: -r features/step_definitions -r features/support --format=pretty
10
+ progress: -r features/step_definitions -r features/support --format=progress
@@ -0,0 +1,8 @@
1
+ Feature: Lookup a provider's NPI record
2
+ In order retrieve the NPI record of a healthcare provider
3
+ As a client system
4
+ I want to query by NPI number
5
+
6
+ Scenario: Retrieving provider record by NPI number
7
+ Given the remote server will respond to an NPI request
8
+ Then the record for NPI number "0123456789" should belong to "JOHN SNOW"
@@ -0,0 +1,8 @@
1
+ Given /^the remote server will respond to an NPI request$/ do
2
+ fake_collective_data_request :npi, "0123456789"
3
+ end
4
+
5
+ Then /^the record for NPI number "([^\"]*)" should belong to "([^\"]*)"$/ do |npi, name|
6
+ provider = Provider.find(npi)
7
+ provider.name.should == name
8
+ end
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'collective_data'
3
+ require 'ruby-debug'
4
+
5
+ require 'test/unit/assertions'
6
+ require File.dirname(__FILE__)+"/../../lib/collective_data_test_helper"
7
+
8
+ include CollectiveData
9
+
10
+ World(Test::Unit::Assertions)
11
+ World(CollectiveData::TestHelper)
@@ -0,0 +1 @@
1
+ {"business_location":{"region":"NE","country":"US","postal_code":"688482168","street2":"","street":"PO BOX 2168","fax":"3088652506","phone":"3088652512","locality":"KEARNEY","id":"4b91b4d518073a29b3000002"},"authorized_official_telephone_number":"","other_first_name":"","entity_type_code":"1","authorized_official_first_name":"","npi_deactivation_date":"","credential_text":"M.D.","gender_code":"M","other_name_suffix_text":"","authorized_official_suffix":"","parent_organization_lbn":null,"npi_reactivation_date":"","authorized_official_prefix":"","parent_organization_tin":null,"sole_proprietor":"X","npi_deactivation_reason_code":"","other_last_name_type_code":"","other_name_prefix_text":"","other_last_name":"","authorized_official_last_name":"","legal_business_name":"","replacement_npi":"","practice_location":{"region":"NE","country":"US","postal_code":"688472944","street2":"","street":"3500 CENTRAL AVE","fax":"3088652506","phone":"3088652512","locality":"KEARNEY","id":"4b91b4d518073a29b3000003"},"authorized_official_credential":"","organization_subpart":"","authorized_official_middle_name":"","last_update_date":"07/08/2007","name_suffix":"","last_name":"SNOW","npi":"0123456789","other_identifiers":[{"issuer":"BCBS","id":"4b91b4d518073a29b3000013","type_code":"01","identifier":"46969","state":"KS"},{"issuer":"","id":"4b91b4d518073a29b3000014","type_code":"04","identifier":"046969WI","state":"KS"},{"issuer":"FIRSTGUARD","id":"4b91b4d518073a29b3000015","type_code":"01","identifier":"645540","state":"KS"},{"issuer":"BCBS","id":"4b91b4d518073a29b3000016","type_code":"01","identifier":"1553","state":"NE"},{"issuer":"","id":"4b91b4d518073a29b3000017","type_code":"04","identifier":"93420WI","state":"NE"},{"issuer":"","id":"4b91b4d518073a29b3000018","type_code":"02","identifier":"B67599","state":""}],"licenses":[{"number":"12637","taxonomy_code":"207X00000X","taxonomy_switch":"Y","state_code":"NE","id":"4b91b4d518073a29b3000004"}],"authorized_official_title":"","enumeration_date":"05/23/2005","other_credential_text":"","other_middle_name":"","other_organization_name":"","name_prefix":"","id":"4b91b4d518073a29b3000001","other_organization_name_type_code":"","middle_name":"A","first_name":"JOHN","ein":""}
@@ -0,0 +1,12 @@
1
+ module CollectiveData
2
+
3
+ class Provider < ActiveResource::Base
4
+ self.site = 'http://data.collectiveidea.com'
5
+ self.prefix = '/npi/'
6
+ self.format = :json
7
+
8
+ def name
9
+ "#{first_name} #{last_name}"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ require 'active_resource'
2
+
3
+ require 'collective_data/provider'
@@ -0,0 +1,20 @@
1
+ require 'fakeweb'
2
+ module CollectiveData
3
+ module TestHelper
4
+ def fake_collective_data_request(request_type, response_file)
5
+ case request_type
6
+ when :npi
7
+ FakeWeb.register_uri :get, "#{Provider.site}#{Provider.prefix}/providers/#{response_file}",
8
+ :body => collective_data_response_path(response_file)
9
+ else
10
+ raise "Unable to fake this data request."
11
+ end
12
+ end
13
+
14
+ def collective_data_response_path(response_file)
15
+ file = File.expand_path(File.join(File.dirname(__FILE__), "..", "features", "support", "fixtures", "#{response_file}.json"))
16
+ raise "Unknown response file" unless File.exist?(file)
17
+ file
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: collective-data
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Keith Gaddis
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-09 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: cucumber
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: This gem allows access to the data portal of CollectiveData from ruby.
33
+ email: keith@collectiveidea.com
34
+ executables: []
35
+
36
+ extensions: []
37
+
38
+ extra_rdoc_files:
39
+ - LICENSE
40
+ - README.rdoc
41
+ files:
42
+ - .document
43
+ - .gitignore
44
+ - LICENSE
45
+ - README.rdoc
46
+ - Rakefile
47
+ - VERSION
48
+ - cucumber.yml
49
+ - features/npi_lookup.feature
50
+ - features/step_definitions/npi_steps.rb
51
+ - features/support/env.rb
52
+ - features/support/fixtures/0123456789.json
53
+ - lib/collective_data.rb
54
+ - lib/collective_data/provider.rb
55
+ - lib/collective_data_test_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/collectiveidea/collective-data
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.6
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: This gem allows access to the data portal of CollectiveData from ruby.
86
+ test_files: []
87
+