Class: BadASS::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/badass/client.rb

Overview

A client to periodically check for new toys and news to avoid spamming the BD API directly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(refresh_rate: 600) ⇒ Client

Creates a client to do API operations.

Parameters:

  • refresh_rate (Integer) (defaults to: 600)

    the rate at which the Client should refresh its list of toys.



5
6
7
8
9
10
11
# File 'lib/badass/client.rb', line 5

def initialize(refresh_rate: 600)
  Thread.new do
    @drops = BadASS.drops
    @sales = BadASS.sales
    sleep(refresh_rate)
  end
end

Instance Attribute Details

#dropsArray<BadASS::Toy> (readonly)

Returns the current drops.

Returns:



14
15
16
# File 'lib/badass/client.rb', line 14

def drops
  @drops
end

#salesArray<BadASS::Sale> (readonly)

Returns the current BD sales.

Returns:



16
17
18
# File 'lib/badass/client.rb', line 16

def sales
  @sales
end