Class: BloomApi::Provider
- Inherits:
-
Object
- Object
- BloomApi::Provider
- Defined in:
- lib/bloom_api/provider.rb
Overview
A class representing a generic provider. This is a base class for individuals and organizations.
Direct Known Subclasses
Instance Method Summary collapse
-
#business_address ⇒ BloomApi::Address
The provider’s business address.
- #deactivation_date ⇒ Date?
-
#deactivation_reason ⇒ String
The reason the provider was deactivated.
-
#initialize(raw_provider) ⇒ Provider
constructor
Create a new provider.
-
#npi ⇒ String
The provider’s national provider identifier.
-
#other_identifiers ⇒ Array
A list of alternate identifiers for the provider.
-
#other_name_type ⇒ String
A type describing the purpose of the provider’s alternate name.
-
#practice_address ⇒ BloomApi::Address
The provider’s practice address.
- #reactivation_date ⇒ Date?
-
#recorded_at ⇒ Date
The date that the provider information was recorded.
-
#replacement_npi ⇒ String
The provider’s replacement npi.
- #sole_proprietor? ⇒ boolean
-
#specialties ⇒ Array
An array of specialties held by the provider.
-
#taxonomy_groups ⇒ Array
An array of taxonomy groups for the provider.
-
#type ⇒ String
The provider type.
-
#updated_at ⇒ Date
The date that the provider’s data was last updated.
Constructor Details
#initialize(raw_provider) ⇒ Provider
Create a new provider
11 12 13 |
# File 'lib/bloom_api/provider.rb', line 11 def initialize(raw_provider) @raw_provider = raw_provider end |
Instance Method Details
#business_address ⇒ BloomApi::Address
Returns the provider’s business address.
16 17 18 |
# File 'lib/bloom_api/provider.rb', line 16 def business_address Address.new(@raw_provider['business_address']) end |
#deactivation_date ⇒ Date?
23 24 25 26 27 |
# File 'lib/bloom_api/provider.rb', line 23 def deactivation_date unless @raw_provider['deactivation_date'].nil? Time.parse(@raw_provider['deactivation_date']).to_date end end |
#deactivation_reason ⇒ String
Returns the reason the provider was deactivated.
30 31 32 |
# File 'lib/bloom_api/provider.rb', line 30 def deactivation_reason @raw_provider['deactivation_reason'] end |
#npi ⇒ String
Returns the provider’s national provider identifier.
35 36 37 |
# File 'lib/bloom_api/provider.rb', line 35 def npi @raw_provider['npi'] end |
#other_identifiers ⇒ Array
Returns A list of alternate identifiers for the provider.
45 46 47 48 49 |
# File 'lib/bloom_api/provider.rb', line 45 def other_identifiers unless @raw_provider['other_identifiers'].nil? @raw_provider['other_identifiers'].collect { |i| BloomApi::Identifier.new(i) } end end |
#other_name_type ⇒ String
Returns a type describing the purpose of the provider’s alternate name.
53 54 55 |
# File 'lib/bloom_api/provider.rb', line 53 def other_name_type @raw_provider['other_name_type'] end |
#practice_address ⇒ BloomApi::Address
Returns the provider’s practice address.
40 41 42 |
# File 'lib/bloom_api/provider.rb', line 40 def practice_address Address.new(@raw_provider['practice_address']) end |
#reactivation_date ⇒ Date?
60 61 62 63 64 |
# File 'lib/bloom_api/provider.rb', line 60 def reactivation_date unless @raw_provider['reactivation_date'].nil? Time.parse(@raw_provider['reactivation_date']).to_date end end |
#recorded_at ⇒ Date
Returns the date that the provider information was recorded.
68 69 70 |
# File 'lib/bloom_api/provider.rb', line 68 def recorded_at Time.parse(@raw_provider['enumeration_date']).to_date end |
#replacement_npi ⇒ String
Returns the provider’s replacement npi.
74 75 76 |
# File 'lib/bloom_api/provider.rb', line 74 def replacement_npi @raw_provider['replacement_npi'] end |
#sole_proprietor? ⇒ boolean
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/bloom_api/provider.rb', line 80 def sole_proprietor? case @raw_provider['sole_proprietor'] when 'yes' true when 'no' false else nil end end |
#specialties ⇒ Array
Returns an array of specialties held by the provider.
92 93 94 95 96 |
# File 'lib/bloom_api/provider.rb', line 92 def specialties unless @raw_provider['provider_details'].nil? @raw_provider['provider_details'].collect { |s| Specialty.new(s) } end end |
#taxonomy_groups ⇒ Array
Returns an array of taxonomy groups for the provider.
99 100 101 102 103 |
# File 'lib/bloom_api/provider.rb', line 99 def taxonomy_groups unless @raw_provider['taxonomy_groups'].nil? @raw_provider['taxonomy_groups'].collect { |g| g['taxonomy']} end end |
#type ⇒ String
Returns The provider type. Possible values are:
-
individual
-
organization.
109 110 111 |
# File 'lib/bloom_api/provider.rb', line 109 def type @raw_provider['type'] end |
#updated_at ⇒ Date
Returns the date that the provider’s data was last updated.
114 115 116 |
# File 'lib/bloom_api/provider.rb', line 114 def updated_at Time.parse(@raw_provider['last_update_date']).to_date end |