Using Bandsintown API in Ruby on Rails

I am fairly new to Ruby on Rails and have done tutorials on making a blogging app. For this web application that I am making, I am trying to implement the Bandsintown api (https://www.bandsintown.com/api/1.0/authentication) so users can see if there are upcoming events for an artist they pick. Unfortunately, after reading http://bandsintown.rubyforge.org/, I still do not understand how to do even the simplest methods. Any help would be appreciated.

  1. Where do I put " require ‘bandsintown’ "?

  2. I use

@venues = Bandsintown::Venue.search({
          :query => "House of Blues",
          :location => "San Diego, CA"
        })

in my controller and then

<pre>
<%= @venues.inspect %>
</pre>

in the corresponding view but that just shows nil.

Any help would be appreciated!

Hi

1) Where do I put " require 'bandsintown' "?

you don't, bundler will do that for you if you put 'gem "bandsintown"'
in Gemfile (as how it should be done).

2) I use

@venues = Bandsintown::Venue.search({
          :query => "House of Blues",
          :location => "San Diego, CA"
        })

in my controller and then

<pre><%= @venues.inspect %></pre>

in the corresponding view but that just shows nil.

I never used the gem but you probably need to set the app_id, for
example, in config/initializers:

# config/initializers/bandsintown.rb
Bandsintown.app_id = 'your_app_id'

Further to Nanya's post I notice that the last release of this gem was
in 2010 for Rails 2.0. It may be worth trying but do not surprised if
it does not work with Rails 4

Colin

Thanh Tran <robotsandwizards@gmail.com> writes:

I am fairly new to Ruby on Rails and have done tutorials on making a
blogging app. For this web application that I am making, I am trying to
implement the Bandsintown api (
https://www.bandsintown.com/api/1.0/authentication) so users can see if
there are upcoming events for an artist they pick. Unfortunately, after
reading http://bandsintown.rubyforge.org/, I still do not understand how to
do even the simplest methods. Any help would be appreciated.

Before sticking an unknown API into a RoR application, I'm going to
suggest learning exactly how it works in a tiny application (just plain
old ruby) such as creating some tests with MiniTest, or even just poking
at it with Pry.

When you know just how it works, then putting it into a RoR app will be
lot easier. It's just a lot harder to debug this sort of thing embedded
in the middle of all that other stuff going on.

Thanh Tran <robotsandwizards@gmail.com> writes:

2) I use

@venues = Bandsintown::Venue.search({
          :query => "House of Blues",
          :location => "San Diego, CA"
        })

in my controller and then

<pre><%= @venues.inspect %></pre>

in the corresponding view but that just shows nil.

Of course, another possibility is that Bandsintown has no listings for a
House of Blues near San Diego.