Class: Poke::API::Auth::Ticket
- Inherits:
-
Object
- Object
- Poke::API::Auth::Ticket
- Includes:
- Logging
- Defined in:
- lib/poke-api/auth/ticket.rb
Instance Attribute Summary collapse
-
#ends ⇒ Object
readonly
Returns the value of attribute ends.
-
#expire ⇒ Object
readonly
Returns the value of attribute expire.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #get_ticket ⇒ Object
- #has_ticket? ⇒ Boolean
-
#initialize ⇒ Ticket
constructor
A new instance of Ticket.
- #is_new_ticket?(new_ticket_time) ⇒ Boolean
- #set_ticket(auth) ⇒ Object
Methods included from Logging
formatter=, log_level=, #logger
Constructor Details
#initialize ⇒ Ticket
Returns a new instance of Ticket.
8 9 10 11 12 |
# File 'lib/poke-api/auth/ticket.rb', line 8 def initialize @expire = nil @start = nil @ends = nil end |
Instance Attribute Details
#ends ⇒ Object (readonly)
Returns the value of attribute ends.
6 7 8 |
# File 'lib/poke-api/auth/ticket.rb', line 6 def ends @ends end |
#expire ⇒ Object (readonly)
Returns the value of attribute expire.
6 7 8 |
# File 'lib/poke-api/auth/ticket.rb', line 6 def expire @expire end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
6 7 8 |
# File 'lib/poke-api/auth/ticket.rb', line 6 def start @start end |
Instance Method Details
#get_ticket ⇒ Object
30 31 32 33 |
# File 'lib/poke-api/auth/ticket.rb', line 30 def get_ticket return false unless check_ticket true end |
#has_ticket? ⇒ Boolean
14 15 16 17 |
# File 'lib/poke-api/auth/ticket.rb', line 14 def has_ticket? return true if @start && @ends && @expire false end |
#is_new_ticket?(new_ticket_time) ⇒ Boolean
25 26 27 28 |
# File 'lib/poke-api/auth/ticket.rb', line 25 def is_new_ticket?(new_ticket_time) return true unless @expire && new_ticket_time > @expire false end |
#set_ticket(auth) ⇒ Object
19 20 21 22 23 |
# File 'lib/poke-api/auth/ticket.rb', line 19 def set_ticket(auth) @expire = auth[:expire_timestamp_ms] @start = auth[:start] @ends = auth[:end] end |