Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: api errors when you put .json in the url #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/rmeetup/fetcher/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def build_url(options)
end

def base_url
"http://api.meetup.com/#{@type}.json/"
url = "http://api.meetup.com/"
url += "#{@type}/" unless @type.nil?
url
end

# Create a query string from an options hash
Expand All @@ -81,4 +83,4 @@ def get_response(url)
end
end
end
end
end
21 changes: 21 additions & 0 deletions rMeetup.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)

Gem::Specification.new do |s|
s.name = "rMeetup"
s.version = "1.0.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Jared Pace", "Jason Berlinsky"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/Jberlinsky/rmeetup"
s.summary = "A simple Ruby gem, providing access to the Meetup API"
#s.description = ""

s.required_rubygems_version = ">= 1.3.6"

s.add_development_dependency "rspec"

s.files = Dir.glob("lib/**/*")
s.require_path = 'lib'
end
4 changes: 2 additions & 2 deletions spec/fetchers/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
it 'should build a correct to call.' do
@options['search'] = 'ruby search'
url = @fetcher.send(:build_url,@options)
url.should eql("http://api.meetup.com/.json/?key=seekret_api_key&search=ruby%20search")
url.should eql("http://api.meetup.com/?key=seekret_api_key&search=ruby%20search")
end

it 'should generate a correct base url' do
@fetcher.send(:base_url).should eql('http://api.meetup.com/.json/')
@fetcher.send(:base_url).should eql('http://api.meetup.com/')
end

it 'should uri encode options' do
Expand Down