class Gratitude::Payday

Constants

PAYDAYS

Attributes

ach_fees_volume[R]
ach_volume[R]
charge_fees_volume[R]
charge_volume[R]
nachs[R]
nactive[R]
ncc_failing[R]
ncc_missing[R]
ncharges[R]
nparticipants[R]
ntippers[R]
ntransfers[R]
number_active[R]
number_of_ach_credits[R]
number_of_achs[R]
number_of_active_users[R]
number_of_charges[R]
number_of_failing_credit_cards[R]
number_of_missing_credit_cards[R]
number_of_participants[R]
number_of_tippers[R]
number_of_transfers[R]
transfer_end_time[R]
transfer_start_time[R]
transfer_volume[R]
ts_end[R]
ts_start[R]

Public Class Methods

all() click to toggle source

Class Methods

# File lib/gratitude/payday.rb, line 55
def self.all
  collect_paydays if PAYDAYS.empty?
  PAYDAYS
end
new(options = {}) click to toggle source
# File lib/gratitude/payday.rb, line 31
def initialize(options = {})
  @ach_fees_volume = options["ach_fees_volume"]
  @ach_volume = options["ach_volume"]
  @charge_fees_volume = options["charge_fees_volume"]
  @charge_volume = options["charge_volume"]
  @number_of_ach_credits = options["nachs"]
  @number_of_active_users = options["nactive"]
  @number_of_failing_credit_cards = options["ncc_failing"]
  @number_of_missing_credit_cards = options["ncc_missing"]
  @number_of_charges = options["ncharges"]
  @number_of_participants = options["nparticipants"]
  @number_of_tippers = options["ntippers"]
  @number_of_transfers = options["ntransfers"]
  @transfer_volume = options["transfer_volume"]
  if options["ts_end"]
    @transfer_end_time = DateTime.parse(options["ts_end"])
  end
  if options["ts_start"]
    @transfer_start_time = DateTime.parse(options["ts_start"])
  end
  PAYDAYS << self
end
newest() click to toggle source
# File lib/gratitude/payday.rb, line 60
def self.newest
  sort_by_ts_end.first
end
oldest() click to toggle source
# File lib/gratitude/payday.rb, line 64
def self.oldest
  sort_by_ts_end.last
end

Private Class Methods

collect_paydays() click to toggle source
# File lib/gratitude/payday.rb, line 78
def self.collect_paydays
  paydays_from_gratipay.each { |payday_hash| Payday.new(payday_hash) }
end
paydays_from_gratipay() click to toggle source
# File lib/gratitude/payday.rb, line 73
def self.paydays_from_gratipay
  faraday.get("/about/paydays.json").body.to_a
end
sort_by_ts_end() click to toggle source
# File lib/gratitude/payday.rb, line 68
def self.sort_by_ts_end
  all.sort_by(&:ts_end).reverse
end