Sha256: 8cbcfc268a9e4b6b86155390a48c6b38ed3d37a8836d50284d5c6725660b3287

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

require 'rack'
require 'json'
require 'nextday'

module Nextday
  class JSON
    def call(env)
      [200, {"Content-Type" => "application/json"}, [data.to_json]]
    end
    
    protected
    def data(current_time = Time.now)
      {
        :cut_off_time         => Nextday::Config.cut_off_time,
        :working_day          => current_time.working_day?,
        :next_working_day     => current_time.next_working_day,
        :previous_working_day => current_time.previous_working_day,
        :despatch_day         => current_time.despatch_day,
        :delivery_day         => current_time.delivery_day
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nextday-0.4.0 lib/nextday/json.rb