Module: Lighthouse
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/lighthouse.rb,
lib/lighthouse/bin.rb,
lib/lighthouse/tag.rb,
lib/lighthouse/base.rb,
lib/lighthouse/user.rb,
lib/lighthouse/token.rb,
lib/lighthouse/ticket.rb,
lib/lighthouse/message.rb,
lib/lighthouse/project.rb,
lib/lighthouse/changeset.rb,
lib/lighthouse/milestone.rb,
lib/lighthouse/membership.rb,
lib/lighthouse/tag_resource.rb,
lib/lighthouse/project_membership.rb
Overview
Ruby lib for working with the Lighthouse API’s XML interface.
The first thing you need to set is the account name. This is the same as the web address for your account.
Lighthouse.account = 'activereload'
Then, you should set the authentication. You can either use your login credentials with HTTP Basic Authentication or with an API Tokens. You can find more info on tokens at lighthouseapp.com/help/using-beacons.
# with basic authentication
Lighthouse.authenticate('[email protected]', 'spacemonkey')
# or, use a token
Lighthouse.token = 'abcdefg'
If no token or authentication info is given, you’ll only be granted public access.
This library is a small wrapper around the REST interface. You should read the docs at lighthouseapp.com/api.
Defined Under Namespace
Classes: Base, Bin, Change, Changeset, Error, Membership, Message, Milestone, Project, ProjectMembership, Tag, TagResource, Ticket, Token, User
Class Attribute Summary collapse
-
.account ⇒ Object
Returns the value of attribute account.
-
.domain_format ⇒ Object
Returns the value of attribute domain_format.
-
.email ⇒ Object
Returns the value of attribute email.
-
.host_format ⇒ Object
Returns the value of attribute host_format.
-
.password ⇒ Object
Returns the value of attribute password.
-
.port ⇒ Object
Returns the value of attribute port.
-
.protocol ⇒ Object
Returns the value of attribute protocol.
-
.token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
-
.authenticate(email, password) ⇒ Object
Sets up basic authentication credentials for all the resources.
- .resources ⇒ Object
- .update_auth(resource) ⇒ Object
- .update_site(resource) ⇒ Object
- .update_token_header(resource) ⇒ Object
Class Attribute Details
.account ⇒ Object
Returns the value of attribute account.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def account @account end |
.domain_format ⇒ Object
Returns the value of attribute domain_format.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def domain_format @domain_format end |
.email ⇒ Object
Returns the value of attribute email.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def email @email end |
.host_format ⇒ Object
Returns the value of attribute host_format.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def host_format @host_format end |
.password ⇒ Object
Returns the value of attribute password.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def password @password end |
.port ⇒ Object
Returns the value of attribute port.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def port @port end |
.protocol ⇒ Object
Returns the value of attribute protocol.
54 55 56 |
# File 'lib/lighthouse.rb', line 54 def protocol @protocol end |
.token ⇒ Object
Returns the value of attribute token.
55 56 57 |
# File 'lib/lighthouse.rb', line 55 def token @token end |
Class Method Details
.authenticate(email, password) ⇒ Object
Sets up basic authentication credentials for all the resources.
58 59 60 61 62 63 64 65 |
# File 'lib/lighthouse.rb', line 58 def authenticate(email, password) self.email = email self.password = password resources.each do |klass| update_auth(klass) end end |
.resources ⇒ Object
75 76 77 |
# File 'lib/lighthouse.rb', line 75 def resources @resources ||= [] end |
.update_auth(resource) ⇒ Object
87 88 89 90 91 |
# File 'lib/lighthouse.rb', line 87 def update_auth(resource) return unless email && password resource.user = email resource.password = password end |
.update_site(resource) ⇒ Object
79 80 81 |
# File 'lib/lighthouse.rb', line 79 def update_site(resource) resource.site = resource.site_format % (host_format % [protocol, domain_format % account, ":#{port}"]) end |