Using Bandsintown API in Ruby on Rails

24 views
Skip to first unread message

Thanh Tran

unread,
Dec 18, 2015, 3:15:24 AM12/18/15
to Ruby on Rails: Talk

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!

nanaya

unread,
Dec 18, 2015, 3:24:55 AM12/18/15
to rubyonra...@googlegroups.com
Hi

On Fri, Dec 18, 2015, at 07:54, Thanh Tran wrote:
>
> 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'

Colin Law

unread,
Dec 18, 2015, 5:03:08 AM12/18/15
to Ruby on Rails: Talk
On 17 December 2015 at 22:54, Thanh Tran <robotsan...@gmail.com> wrote:
> 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.

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

Tamara Temple

unread,
Dec 18, 2015, 3:57:07 PM12/18/15
to rubyonra...@googlegroups.com

Thanh Tran <robotsan...@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.


--
Tamara Temple
tam...@gmail.com
http://www.tamouse.org

Tamara Temple

unread,
Dec 18, 2015, 4:01:38 PM12/18/15
to rubyonra...@googlegroups.com

Thanh Tran <robotsan...@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.
Reply all
Reply to author
Forward
0 new messages