class Milker::LOL

Attributes

end_date[RW]
start_date[RW]

Public Class Methods

new(options={}) click to toggle source
# File lib/milker/LOL/lol.rb, line 8
def initialize(options={})
  @token = options.fetch(:token, nil)
end

Public Instance Methods

daily_receipts(start_date: nil, end_date: nil) click to toggle source
# File lib/milker/LOL/lol.rb, line 17
def daily_receipts(start_date: nil, end_date: nil)
  response = self.class.get "/DailyRcpts/#{@token}/#{start_date}/#{end_date}"
  convert_hash_keys(response.parsed_response)
end
daily_tests(start_date: nil, end_date: nil) click to toggle source
# File lib/milker/LOL/lol.rb, line 12
def daily_tests(start_date: nil, end_date: nil)
  response = self.class.get "/DailyTests/#{@token}/#{start_date}/#{end_date}"
  convert_hash_keys(response.parsed_response)
end

Private Instance Methods

convert_hash_keys(value) click to toggle source

stackoverflow.com/a/8707236/1129050

# File lib/milker/LOL/lol.rb, line 25
def convert_hash_keys(value)
  case value
  when Array
    value.map { |v| convert_hash_keys(v) }
  when Hash
    Hash[value.map { |k, v| [k.gsub(/(TEST|RCPT)_/, '').downcase, convert_hash_keys(v)] }]
  else
    value
 end
end