Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
2 lib/bandsintown.rb
@@ -3,7 +3,7 @@
require 'rubygems'
require 'cgi'
-require 'active_support'
+require 'active_support/all'
require 'json'
require 'rest_client'
View
3 lib/bandsintown/artist.rb
@@ -126,7 +126,7 @@ def self.get(options = {})
end
def self.build_from_json(json_hash)
- returning Bandsintown::Artist.new({}) do |artist|
+ Bandsintown::Artist.new({}).tap do |artist|
artist.name = json_hash['name']
artist.mbid = json_hash['mbid']
artist.bandsintown_url = json_hash['url']
@@ -153,6 +153,5 @@ def build_bandsintown_url
"http://www.bandsintown.com/mbid_#{@mbid}"
end
end
-
end
end
View
2 lib/bandsintown/base.rb
@@ -36,7 +36,7 @@ def to_hash
self.instance_variables.each do |ivar|
value = self.instance_variable_get(ivar)
next if value.blank?
- hash[:"#{ivar.gsub('@', '')}"] = value
+ hash[:"#{ivar.to_s.gsub('@', '')}"] = value
end
hash
end
View
4 lib/bandsintown/event.rb
@@ -250,7 +250,7 @@ def self.resource_path
end
def self.build_from_json(json_hash)
- returning Bandsintown::Event.new do |event|
+ Bandsintown::Event.new.tap do |event|
event.bandsintown_id = json_hash["id"]
event.bandsintown_url = json_hash["url"]
event.datetime = Time.parse(json_hash["datetime"])
@@ -262,7 +262,5 @@ def self.build_from_json(json_hash)
event.artists = json_hash["artists"].map { |artist| Bandsintown::Artist.new(artist.symbolize_keys) }
end
end
-
-
end
end
View
8 lib/bandsintown/venue.rb
@@ -4,7 +4,7 @@ class Venue < Base
#Note - address and postalcode are not returned in API responses, but they are accepted when passing venue data to Bandsintown::Event.create.
attr_accessor :address, :postalcode
-
+
def initialize(bandsintown_id)
@bandsintown_id = bandsintown_id
end
@@ -52,13 +52,13 @@ def events
def self.search(options = {})
self.request_and_parse(:get, "search", options).map { |venue_hash| Bandsintown::Venue.build_from_json(venue_hash) }
end
-
+
def self.resource_path
"venues"
end
def self.build_from_json(args={})
- returning Bandsintown::Venue.new(args['id']) do |v|
+ Bandsintown::Venue.new(args['id']).tap do |v|
v.name = args["name"]
v.bandsintown_url = args["url"]
v.bandsintown_id = args["id"]
@@ -68,6 +68,6 @@ def self.build_from_json(args={})
v.latitude = args["latitude"]
v.longitude = args["longitude"]
end
- end
+ end
end
end
View
2 spec/bandsintown/artist_spec.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
describe Bandsintown::Artist do
View
2 spec/spec_helper.rb
@@ -5,7 +5,7 @@
rescue LoadError
require 'rubygems'
gem 'rspec'
- require 'spec'
+ #require 'spec'
end
$:.unshift(File.dirname(__FILE__) + '/../lib')

No commit comments for this range

Something went wrong with that request. Please try again.