Sha256: 09eec6fb2a13c5b00af2cb37e42adf12e98aedd9cad0b0ff30e99e0a499b2bf9

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

module ChurchCommunityBuilder

  # This adapter is the standard for all loading objects.
  class ApiReader
    attr_reader :headers

    # Constructor
    # def initialize
    # end

    # Loads the list
    #
    # @return the data loaded in a JSON object.
    def load_feed 
      @url_data_params ||= {}
      response = ChurchCommunityBuilder::admin_request(:get, @url_data_params)
      data = _xml2json(response.body)
      @headers = response.headers
      return data
    end

    private

    def _xml2json(xml)
      # {KeepRoot: true, ForceArray: false, SuppressEmpty: true} were set to 
      # maximize compatibility with Hash.from_xml, used previously.
      #
      XmlSimple.xml_in(xml, {KeepRoot: true, ForceArray: false, SuppressEmpty: true})
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
church-community-builder-0.2.2 lib/readers/api_reader.rb
church-community-builder-0.2.1 lib/readers/api_reader.rb
church-community-builder-0.2.0 lib/readers/api_reader.rb