Sha256: f9ffbe93670281535cf9112f26432b967216f8dba44f854dd510e441233bdf6d

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

module ChurchCommunityBuilder

  include Enumerable

  # A ValidIndividual is the data returned when querying CCB for 'valid_individuals'
  # A ValidIndividual is largely metadata about the individual,
  # as well as the inviduals ID.  From the ID, the individual can be retrieved.
  #
  class ValidIndividual < ApiObject

    ccb_attr_accessor :id,
                      :active,
                      :creator,
                      :modifier,
                      :created,
                      :modified


    def initialize(json_data = nil, options = {})
      #@writer_object = PersonWriter
      
      # When we initialize from IndividualReader, the "Individual" is buried
      if json_data["ccb_api"].nil?
        individual_json = json_data
      else
        individual_json = json_data["ccb_api"]["response"]["individuals"]["individual"]
      end
      
      initialize_from_json_object(individual_json) unless individual_json.nil?

    end

    # def self.load_by_id(individual_id)
    #   reader = IndividualReader.new(individual_id)
    #   self.new(reader.load_feed)
    # rescue
    #   nil
    # end


  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
church-community-builder-0.2.2 lib/api/valid_individual.rb
church-community-builder-0.2.1 lib/api/valid_individual.rb
church-community-builder-0.2.0 lib/api/valid_individual.rb
church-community-builder-0.1.6 lib/api/valid_individual.rb
church-community-builder-0.1.5 lib/api/valid_individual.rb
church-community-builder-0.1.4 lib/api/valid_individual.rb
church-community-builder-0.1.3 lib/api/valid_individual.rb
church-community-builder-0.1.2 lib/api/valid_individual.rb
church-community-builder-0.1.1 lib/api/valid_individual.rb
church-community-builder-0.1.0 lib/api/valid_individual.rb