Coder Social home page Coder Social logo

lighthouse-api's Introduction

Lighthouse API

The official Ruby library for interacting with the Lighthouse REST API.

Documentation & Requirements

  • ActiveResource
  • ActiveSupport

Check out lib/lighthouse.rb for examples and documentation.

Using The Lighthouse Console

The Lighthouse library comes with a convenient console for testing and quick commands (or whatever else you want to use it for).

From /lib:

# For ruby 1.9
# irb -I. -r lighthouse/console.rb

irb -r lighthouse/console

Lighthouse.account = "activereload"

#### You can use `authenticate` OR `token`
Lighthouse.authenticate('username', 'password')
#Lighthouse.token = 'YOUR_TOKEN'

Project.find(:all)

Contributions

  • technoweenie (rick)
  • caged (Justin Palmer)
  • granth (Grant Hollingworth)
  • kneath (Kyle Neath)
  • djanowski (Damian Janowski)
  • drnic (Dr Nic Williams)
  • texel (Leigh Caplan)
  • trptcolin (Colin Jones)
  • cyberfox (Morgan Schweers)
  • krekoten (Крекотень Мар'ян)

lighthouse-api's People

Contributors

caged avatar cyberfox avatar djanowski avatar drnic avatar granth avatar kneath avatar krekoten avatar technoweenie avatar trptcolin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lighthouse-api's Issues

No recent gem?

Are you going to release a gem with the latest changes to gemcutter? Currently only 1.0.0 exists on the github gem server, and it is outdated...

Inconsistent parsing => REXML::ParseException

on console...seeing inconsistent parsing behavior. first three times it returned all 100+ projects we have. waited 15 sec, tried again, got exception. example below.

irb(main):022:0> Lighthouse.account = LH_ACCOUNT
irb(main):022:0> Lighthouse.token = LH_TOKEN
irb(main):022:0> Lighthouse::Project.find(:all)
REXML::ParseException: #<REXML::ParseException: #<NoMethodError: undefined method []' for nil:NilClass> /opt/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:330:in pull'
/opt/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:22:inparse' /opt/local/lib/ruby/1.8/rexml/document.rb:227:in build'
/opt/local/lib/ruby/1.8/rexml/document.rb:43:ininitialize' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:17:in new'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:17:inparse' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in send'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:inparse' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/hash/conversions.rb:164:in from_xml'
/opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/formats/xml_format.rb:19:indecode' /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/connection.rb:138:in get'
/opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:639:infind_every' /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:582:in find'
(irb):22:inirb_binding' /opt/local/lib/ruby/1.8/irb/workspace.rb:52:in irb_binding'
:0
...
Exception parsing
Line:
Position:
Last 80 unconsumed characters:

/opt/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:418:inpull' /opt/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:22:in parse'
/opt/local/lib/ruby/1.8/rexml/document.rb:227:inbuild' /opt/local/lib/ruby/1.8/rexml/document.rb:43:in initialize'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:17:innew' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:17:in parse'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in**send**' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in parse'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/hash/conversions.rb:164:infrom_xml' /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/formats/xml_format.rb:19:in decode'
/opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/connection.rb:138:inget' /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:639:in find_every'
/opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:582:infind' (irb):22:in irb_binding'
/opt/local/lib/ruby/1.8/irb/workspace.rb:52:in`irb_binding'
:0
-- truncated --

Exception parsing
Line:
Position:
Last 80 unconsumed characters:
</default-assigned-user
Line:
Position:
Last 80 unconsumed characters:
</default-assigned-user
from /opt/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:92:in parse' from /opt/local/lib/ruby/1.8/rexml/document.rb:227:inbuild'
from /opt/local/lib/ruby/1.8/rexml/document.rb:43:in initialize' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:17:innew'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:17:in parse' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:insend'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in parse' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/hash/conversions.rb:164:infrom_xml'
from /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/formats/xml_format.rb:19:in decode' from /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/connection.rb:138:inget'
from /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:639:in find_every' from /opt/local/lib/ruby/gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:582:infind'
from (irb):22
from :0

Can no longer fetch tickets

I have a small program that once a week checks how many tickets we have in different buckets.
Since a few weeks ago I can no longer fetch the tickets from the api.

I get the following error
rake aborted!
LoadError: cannot load such file -- active_support/core_ext/module/attr_accessor_with_default

The callback says its from the tag.rb file.

I can't figure out what changed, it seems nothing in the api changed.
Is there a breaking change on the web side?

Versions not being marshaled into a Ticket object

Ben Langerfeld and I noticed that the Versions which gives you the history of the ticket is not being marshaled into that object. The Lighthouse API appears to be returning it, but ActiveResource doesn't appear to be handling this correctly. From what we can tell it looks like either the API return should be fixed or a different method should be used to un-marshall the tickets.

Regression: Crash when creating a ticket through API using a tag

Hello,

I just ran into this trying to create tickets using tags - this used to work in the previous version of the gem.

API call:

Lighthouse::Ticket.create(:project_id => ,
:title => "Fake",
:state => "pending",
:tag => "fake,",
:assigned_user_id => )

Stack Trace:

NoMethodError: undefined method returning' for #<Lighthouse::Ticket:0x105c7a9d8> from /opt/local/lib/ruby/gems/1.8/gems/activeresource-3.0.7/lib/active_resource/base.rb:1401:inmethod_missing'
from /opt/local/lib/ruby/gems/1.8/gems/lighthouse-api-2.0/lib/lighthouse/ticket.rb:84:in cleanup_tags' from /opt/local/lib/ruby/gems/1.8/gems/lighthouse-api-2.0/lib/lighthouse/ticket.rb:80:inparse_with_spaces'
from /opt/local/lib/ruby/gems/1.8/gems/lighthouse-api-2.0/lib/lighthouse/ticket.rb:38:in tags' from /opt/local/lib/ruby/gems/1.8/gems/lighthouse-api-2.0/lib/lighthouse/ticket.rb:60:insave'
from /opt/local/lib/ruby/gems/1.8/gems/activeresource-3.0.7/lib/active_resource/base.rb:710:in create' from /opt/local/lib/ruby/gems/1.8/gems/activeresource-3.0.7/lib/active_resource/base.rb:710:intap'
from /opt/local/lib/ruby/gems/1.8/gems/activeresource-3.0.7/lib/active_resource/base.rb:710:in `create'
from (irb):175
from :0

This is blocking me from creating tickets, which I have to do asap. Please help? :)

Overriding ActiveResource::Connection clobbers any other HTTP Basic Auth

The code below makes it impossible to use Basic Auth anywhere else in your app once the lighthouse API gem is included.

Why not set self.user and self.password on the Lighthouse::Base which inherits from ActiveResource?

module ActiveResource
  class Connection
    private
      def authorization_header
        (Lighthouse.email || Lighthouse.password ? { 'Authorization' => 'Basic ' + ["#{Lighthouse.email}:#{Lighthouse.password}"].pack('m').delete("\r\n") } : {})
      end
  end
end 

Issue with #valid? and setting errors on tickets

Im not sure if this an issue with activeresource or the lighthouse API, but here's what I see...

    ree-1.8.7-2010.02 > ticket = Lighthouse::Ticket.new
     => #<Lighthouse::Ticket:0x1051a7308 @prefix_options={}, @attributes={}> 
    ree-1.8.7-2010.02 > ticket.valid?
     => true 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 
    ree-1.8.7-2010.02 > ticket.errors.add :base, 'this is an invalid ticket'
     => ["this is an invalid ticket"] 
    ree-1.8.7-2010.02 > ticket.valid?
     => true 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 
    ree-1.8.7-2010.02 > ticket = Lighthouse::Ticket.new
     => #<Lighthouse::Ticket:0x105194028 @prefix_options={}, @attributes={}> 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 
    ree-1.8.7-2010.02 > ticket.errors.add :base, 'this is an invalid ticket'
     => ["this is an invalid ticket"] 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {:base=>["this is an invalid ticket"]}> 
    ree-1.8.7-2010.02 > ticket.valid?
     => true 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 

I dug through activeresource a bit - it's #valid? method clears the errors, then runs callbacks to add them back in. Is this an issue with how lighthouse ticket is using that, or with ActiveResource itself?

"milestones" method not working for projects

There appears to be something wrong with the "milestones" methods for individual projects:

>> p.milestones
ArgumentError: expected an attributes Hash, got "1"
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:1217:in `load'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:965:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:889:in `new'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:889:in `instantiate_record'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:885:in `instantiate_collection'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:885:in `collect!'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:885:in `instantiate_collection'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:857:in `find_every'
    from /Library/Ruby/Gems/1.8/gems/activeresource-3.0.14/lib/active_resource/base.rb:777:in `find'
    from /Library/Ruby/Gems/1.8/gems/lighthouse-api-2.0/lib/lighthouse/project.rb:55:in `milestones'

Do you have a quick fix for this? If not, I can do some investigating on my own.

Segmentation fault

When I require the file thusly:

require File.dirname(__FILE__) + "/lighthouse-api/lib/lighthouse"

I get:

~/.rvm/gems/ruby-1.9.2-p180/gems/json-1.5.3/ext/json/ext/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

I also tried gem install with a simple require and got the same result. Help please?

Addressable not a dependency.

I used the lighthouse-api gem in my project and got:

Install the Addressable gem (with dependencies) to support accounts with subdomains.
# sudo gem install addressable --development
no such file to load -- addressable/uri

Thanks for the warning, but it needs to be a dependency in the gemfile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.