class BloomApi::Provider
A class representing a generic provider. This is a base class for individuals and organizations.
Public Class Methods
Create a new provider @param [Hash]
a hash representation of a json provider object from the bloom API
# File lib/bloom_api/provider.rb, line 11 def initialize(raw_provider) @raw_provider = raw_provider end
Public Instance Methods
@return [BloomApi::Address] the provider’s business address
# File lib/bloom_api/provider.rb, line 16 def business_address Address.new(@raw_provider['business_address']) end
@return [Date]
if the provider has been deactivated returns the date of deactivation
@return [nil] if the the provider has not been deactivated
# 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
@return [String] the reason the provider was deactivated
# File lib/bloom_api/provider.rb, line 30 def deactivation_reason @raw_provider['deactivation_reason'] end
@return [String] the provider’s national provider identifier
# File lib/bloom_api/provider.rb, line 35 def npi @raw_provider['npi'] end
@return [Array] A list of alternate identifiers for the provider
# 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
@return [String]
a type describing the purpose of the provider's alternate name
# File lib/bloom_api/provider.rb, line 53 def other_name_type @raw_provider['other_name_type'] end
@return [BloomApi::Address] the provider’s practice address
# File lib/bloom_api/provider.rb, line 40 def practice_address Address.new(@raw_provider['practice_address']) end
@return [Date]
the reactivation date for the provider if it's been reactivated
@return [nil] if the provider has not been reactivated
# 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
@return [Date]
the date that the provider information was recorded
# File lib/bloom_api/provider.rb, line 68 def recorded_at Time.parse(@raw_provider['enumeration_date']).to_date end
@return [String]
the provider's replacement npi
# File lib/bloom_api/provider.rb, line 74 def replacement_npi @raw_provider['replacement_npi'] end
@return [boolean] true if the provider is a sole proprietor @return [boolean] false if the provider is not a sole proprietor
# 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
@return [Array] an array of specialties held by the provider
# 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
@return [Array] an array of taxonomy groups for the provider
# 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
@return [String]
The provider type. Possible values are: * individual * organization
# File lib/bloom_api/provider.rb, line 109 def type @raw_provider['type'] end
@return [Date] the date that the provider’s data was last updated
# File lib/bloom_api/provider.rb, line 114 def updated_at Time.parse(@raw_provider['last_update_date']).to_date end