class BloomApi::Provider

A class representing a generic provider. This is a base class for individuals and organizations.

Public Class Methods

new(raw_provider) click to toggle source

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

business_address() click to toggle source

@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
deactivation_date() click to toggle source

@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
deactivation_reason() click to toggle source

@return [String] the reason the provider was deactivated

# File lib/bloom_api/provider.rb, line 30
def deactivation_reason
  @raw_provider['deactivation_reason']
end
npi() click to toggle source

@return [String] the provider’s national provider identifier

# File lib/bloom_api/provider.rb, line 35
def npi
  @raw_provider['npi']
end
other_identifiers() click to toggle source

@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
other_name_type() click to toggle source

@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
practice_address() click to toggle source

@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
reactivation_date() click to toggle source

@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
recorded_at() click to toggle source

@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
replacement_npi() click to toggle source

@return [String]

the provider's replacement npi
# File lib/bloom_api/provider.rb, line 74
def replacement_npi
  @raw_provider['replacement_npi']
end
sole_proprietor?() click to toggle source

@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
specialties() click to toggle source

@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
taxonomy_groups() click to toggle source

@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
type() click to toggle source

@return [String]

The provider type. Possible values are:
* individual
* organization
# File lib/bloom_api/provider.rb, line 109
def type
  @raw_provider['type']
end
updated_at() click to toggle source

@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