Sha256: 42a29a40e12f465a8f00d81318087cde40ac1deb1964a77ba8f78a3fd1a6ce6f

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require 'net/http'

module NetworkExecutive
  module Components
    module PhotoPlayer

      def url
        NetworkExecutive::Engine.routes.url_helpers.slideshow_path
      end

      def refresh
        false
      end

      def onload
        {
          photos: photos
        }
      end

      def feed_url
        raise NotImplementedError
      end

      def photos
        []
      end

      def feed
        _url = URI.parse( feed_url )
        http = Net::HTTP.new( _url.host, _url.port )

        if _url.scheme == 'https'
          http.use_ssl     = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        end

        request  = Net::HTTP::Get.new( _url.request_uri )
        response = http.request( request )

        JSON.parse response.body
      rescue StandardError
        {}
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
network_executive-0.0.8 lib/network_executive/components/photo_player.rb
network_executive-0.0.7 lib/network_executive/components/photo_player.rb