Sha256: ae51c009d8aebbe67532be7f275a28dd28648394f6e74c1150b4a24c2eca040d

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

require "httparty"

module Middleman::Features::RemoteData
  class << self
    def registered(app)
      app.extend ClassMethods
    end
    alias :included :registered
  end
  
  module ClassMethods
    # Makes HTTP json data available in the data object
    #
    #     data_source :my_json, "http://my/file.json"
    #
    # Available in templates as:
    #
    #     data.my_json
    def data_source(name, url)
      data_callback(name) do
        HTTParty.get(url).parsed_response
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-remote-data-0.1.0 lib/middleman-remote-data.rb