Class: BloomApi::Provider

Inherits:
Object
  • Object
show all
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

Individual, Organization

Instance Method Summary collapse

Constructor Details

#initialize(raw_provider) ⇒ Provider

Create a new provider

Parameters:

  • a (Hash)

    hash representation of a json provider object from the bloom API


11
12
13
# File 'lib/bloom_api/provider.rb', line 11

def initialize(raw_provider)
  @raw_provider = raw_provider
end

Instance Method Details

#business_addressBloomApi::Address

Returns the provider's business address.

Returns:


16
17
18
# File 'lib/bloom_api/provider.rb', line 16

def business_address
  Address.new(@raw_provider['business_address'])
end

#deactivation_dateDate?

Returns:

  • (Date)

    if the provider has been deactivated returns the date of deactivation

  • (nil)

    if the the provider has not been deactivated


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_reasonString

Returns the reason the provider was deactivated.

Returns:

  • (String)

    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

#npiString

Returns the provider's national provider identifier.

Returns:

  • (String)

    the provider's national provider identifier


35
36
37
# File 'lib/bloom_api/provider.rb', line 35

def npi
  @raw_provider['npi']
end

#other_identifiersArray

Returns A list of alternate identifiers for the provider.

Returns:

  • (Array)

    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_typeString

Returns a type describing the purpose of the provider's alternate name.

Returns:

  • (String)

    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_addressBloomApi::Address

Returns the provider's practice address.

Returns:


40
41
42
# File 'lib/bloom_api/provider.rb', line 40

def practice_address
  Address.new(@raw_provider['practice_address'])
end

#reactivation_dateDate?

Returns:

  • (Date)

    the reactivation date for the provider if it's been reactivated

  • (nil)

    if the provider has not been reactivated


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_atDate

Returns the date that the provider information was recorded.

Returns:

  • (Date)

    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_npiString

Returns the provider's replacement npi.

Returns:

  • (String)

    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

Returns:

  • (boolean)

    true if the provider is a sole proprietor

  • (boolean)

    false if the provider is not a sole proprietor


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

#specialtiesArray

Returns an array of specialties held by the provider.

Returns:

  • (Array)

    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_groupsArray

Returns an array of taxonomy groups for the provider.

Returns:

  • (Array)

    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

#typeString

Returns The provider type. Possible values are:

  • individual

  • organization.

Returns:

  • (String)

    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_atDate

Returns the date that the provider's data was last updated.

Returns:

  • (Date)

    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