Class: Spire
- Inherits:
-
Object
- Object
- Spire
- Defined in:
- lib/spire_io.rb,
lib/spire/api.rb,
lib/spire/api/event.rb,
lib/spire/api/member.rb,
lib/spire/api/account.rb,
lib/spire/api/channel.rb,
lib/spire/api/session.rb,
lib/spire/api/resource.rb,
lib/spire/commands/cli.rb,
lib/spire/api/application.rb,
lib/spire/api/requestable.rb,
lib/spire/api/notification.rb,
lib/spire/api/subscription.rb,
lib/spire/commands/console.rb,
lib/spire/commands/register.rb,
lib/spire/commands/mixins/help.rb,
lib/spire/commands/mixins/authenticate.rb
Defined Under Namespace
Modules: Commands Classes: API
Constant Summary collapse
- RETRY_CREATION_LIMIT =
How many times we will try to fetch a channel or subscription after getting a 409 Conflict.
3
Instance Attribute Summary collapse
-
#api ⇒ Object
Spire API object.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#session ⇒ Object
Spire session.
Instance Method Summary collapse
-
#initialize(url = "https://api.spire.io") ⇒ Spire
constructor
A new instance of Spire.
-
#login(login, password) ⇒ Object
Authenticates a session using a login and password.
- #password_reset_request(email) ⇒ Object
-
#register(info) ⇒ Object
Register for a new spire account, and authenticates as the newly created account.
- #start(secret) ⇒ Object
Constructor Details
Instance Attribute Details
#api ⇒ Object
Spire API object. Has low-level methods for accessing the spire.io API.
15 16 17 |
# File 'lib/spire_io.rb', line 15 def api @api end |
#resources ⇒ Object
Returns the value of attribute resources.
15 16 17 |
# File 'lib/spire_io.rb', line 15 def resources @resources end |
#session ⇒ Object
Spire session. Contains methods for creating channels, subscriptions, and applications.
15 |
# File 'lib/spire_io.rb', line 15 attr_accessor :api, :session, :resources |
Instance Method Details
#login(login, password) ⇒ Object
Authenticates a session using a login and password
29 30 31 32 |
# File 'lib/spire_io.rb', line 29 def login(login, password) @session = @api.login(login, password) self end |
#password_reset_request(email) ⇒ Object
43 44 45 |
# File 'lib/spire_io.rb', line 43 def password_reset_request(email) @api.password_reset_request(email) end |
#register(info) ⇒ Object
Register for a new spire account, and authenticates as the newly created account
38 39 40 41 |
# File 'lib/spire_io.rb', line 38 def register(info) @session = @api.create_account(info) self end |
#start(secret) ⇒ Object
23 24 25 26 |
# File 'lib/spire_io.rb', line 23 def start(secret) @session = @api.create_session(secret) self end |