Sha256: fe76f207e8d12dbf089b34e3cbe3a2a3554ce6ccfb64cdad82823b292b3df387

Contents?: true

Size: 796 Bytes

Versions: 7

Compression:

Stored size: 796 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

7 entries across 7 versions & 1 rubygems

Version Path
church-community-builder-0.1.6 lib/readers/api_reader.rb
church-community-builder-0.1.5 lib/readers/api_reader.rb
church-community-builder-0.1.4 lib/readers/api_reader.rb
church-community-builder-0.1.3 lib/readers/api_reader.rb
church-community-builder-0.1.2 lib/readers/api_reader.rb
church-community-builder-0.1.1 lib/readers/api_reader.rb
church-community-builder-0.1.0 lib/readers/api_reader.rb