Class: NoidsClient::Pool
- Inherits:
-
Object
- Object
- NoidsClient::Pool
- Defined in:
- lib/noids_client/pool.rb
Instance Attribute Summary collapse
-
#ids_used ⇒ Object
readonly
Returns the value of attribute ids_used.
-
#last_mint_date ⇒ Object
readonly
Returns the value of attribute last_mint_date.
-
#max_ids ⇒ Object
readonly
Returns the value of attribute max_ids.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #advance_past(this_id) ⇒ Object
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(rest_resource) ⇒ Pool
constructor
A new instance of Pool.
- #mint(this_many_ids = 1) ⇒ Object
- #open ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(rest_resource) ⇒ Pool
Returns a new instance of Pool.
8 9 10 11 |
# File 'lib/noids_client/pool.rb', line 8 def initialize(rest_resource) @noid_pool = rest_resource update end |
Instance Attribute Details
#ids_used ⇒ Object (readonly)
Returns the value of attribute ids_used.
6 7 8 |
# File 'lib/noids_client/pool.rb', line 6 def ids_used @ids_used end |
#last_mint_date ⇒ Object (readonly)
Returns the value of attribute last_mint_date.
6 7 8 |
# File 'lib/noids_client/pool.rb', line 6 def last_mint_date @last_mint_date end |
#max_ids ⇒ Object (readonly)
Returns the value of attribute max_ids.
6 7 8 |
# File 'lib/noids_client/pool.rb', line 6 def max_ids @max_ids end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/noids_client/pool.rb', line 6 def name @name end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
6 7 8 |
# File 'lib/noids_client/pool.rb', line 6 def template @template end |
Instance Method Details
#advance_past(this_id) ⇒ Object
33 34 35 |
# File 'lib/noids_client/pool.rb', line 33 def advance_past(this_id) decode_json(@noid_pool['advancePast'].post '', params: {id: this_id}) end |
#close ⇒ Object
21 22 23 |
# File 'lib/noids_client/pool.rb', line 21 def close decode_json(@noid_pool['close'].put '') end |
#closed? ⇒ Boolean
25 26 27 |
# File 'lib/noids_client/pool.rb', line 25 def closed? @is_closed end |
#mint(this_many_ids = 1) ⇒ Object
29 30 31 |
# File 'lib/noids_client/pool.rb', line 29 def mint(this_many_ids=1) JSON.parse(@noid_pool['mint'].post '', params: {n: this_many_ids}) end |
#open ⇒ Object
17 18 19 |
# File 'lib/noids_client/pool.rb', line 17 def open decode_json(@noid_pool['open'].put '') end |
#update ⇒ Object
13 14 15 |
# File 'lib/noids_client/pool.rb', line 13 def update decode_json(@noid_pool.get) end |