yelp4r 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -37,9 +37,10 @@ begin
37
37
  "examples/yelp.rb"
38
38
  ]
39
39
  s.authors = ["Tom Cocca"]
40
- s.add_dependency 'httparty'
40
+ s.add_dependency "httparty", ">= 0.6.1"
41
+ s.add_dependency "hashie", ">= 0.4.0"
42
+ s.add_dependency "rash", ">= 0.2.0"
41
43
  s.add_dependency 'nokogiri'
42
- s.add_dependency 'mash'
43
44
  s.add_development_dependency "rspec"
44
45
  end
45
46
  Jeweler::GemcutterTasks.new
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :patch: 0
3
3
  :major: 1
4
- :minor: 1
5
4
  :build:
5
+ :minor: 2
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../lib/yelp4r'
4
4
  # http://www.yelp.com/developers/documentation
5
5
 
6
6
  # Initialize a new Yelp Client
7
- client = Yelp4r::Client.new('your_ywsid_key')
7
+ client = Yelp4r::Client.new('your_ywsid_here')
8
8
 
9
9
 
10
10
  # Initialize a new Phone Search object
@@ -14,7 +14,7 @@ phone_search = Yelp4r::PhoneSearch.new(client)
14
14
  results = phone_search.search_by_phone_number('1234567890')
15
15
 
16
16
  # A response object is returned
17
- # The response is either a Mash Object or an array of Mash objects, these are hashes that have been converted into OpenStruct-esque objects
17
+ # The response is either a Rash Object or an array of Rash objects, these are hashes that have been converted into OpenStruct-esque objects
18
18
  # Also all keys have been rubyified, eg: results.body['camelCase] is now results.body.camel_case
19
19
  # The following response methods are available to all Yelp searches in the 3 search classes
20
20
  # PhoneSearch, ReveiwSearch, NeighborhoodSearch
@@ -59,7 +59,7 @@ results = review_search.search_by_bounding_box(38, -122.6, 37.788022, -122.39979
59
59
  # This method accepts and optional param of
60
60
  # :radius => max of 25
61
61
  results = review_search.search_by_geocode_and_radius(37.788022, -122.399797)
62
- results = review_search.search_by_geocode_and_radius(37.788022, -122.399797, :radius => .5)
62
+ results = review_search.search_by_geocode_and_radius(37.788022, -122.399797, :radius => 0.5)
63
63
  results = review_search.search_by_geocode_and_radius(37.788022, -122.399797, :category => "bars", :radius => 1)
64
64
 
65
65
  # Search by location
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'httparty'
3
- require 'mash'
4
- require 'rubyify_keys'
3
+ require 'hashie'
4
+ require 'rash'
5
5
 
6
6
  require 'yelp4r/client'
7
7
  require 'yelp4r/phone_search'
@@ -4,7 +4,7 @@ module Yelp4r
4
4
  attr_accessor :body
5
5
 
6
6
  def initialize(response)
7
- @body = mash_response(response)
7
+ @body = rash_response(response)
8
8
  end
9
9
 
10
10
  def response_code
@@ -29,18 +29,18 @@ module Yelp4r
29
29
 
30
30
  private
31
31
 
32
- def mash_response(response)
32
+ def rash_response(response)
33
33
  if response.is_a?(Array)
34
34
  @body = []
35
35
  response.each do |b|
36
36
  if b.is_a?(Hash)
37
- @body << Mash.new(b.rubyify_keys!)
37
+ @body << Hashie::Rash.new(b)
38
38
  else
39
39
  @body << b
40
40
  end
41
41
  end
42
42
  elsif response.is_a?(Hash)
43
- @body = Mash.new(response.rubyify_keys!)
43
+ @body = Hashie::Rash.new(response)
44
44
  else
45
45
  @body = response
46
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yelp4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Cocca
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-09 00:00:00 -05:00
12
+ date: 2010-11-10 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,20 +20,30 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 0.6.1
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: nokogiri
26
+ name: hashie
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: "0"
33
+ version: 0.4.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rash
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.2.0
34
44
  version:
35
45
  - !ruby/object:Gem::Dependency
36
- name: mash
46
+ name: nokogiri
37
47
  type: :runtime
38
48
  version_requirement:
39
49
  version_requirements: !ruby/object:Gem::Requirement
@@ -67,7 +77,6 @@ files:
67
77
  - Rakefile
68
78
  - VERSION.yml
69
79
  - examples/yelp.rb
70
- - lib/rubyify_keys.rb
71
80
  - lib/yelp4r.rb
72
81
  - lib/yelp4r/categories.rb
73
82
  - lib/yelp4r/client.rb
@@ -1,29 +0,0 @@
1
- class Hash
2
-
3
- # Converts all of the keys to strings, optionally formatting key name
4
- def rubyify_keys!
5
- keys.each{|k|
6
- v = delete(k)
7
- new_key = k.to_s.to_underscore!
8
- self[new_key] = v
9
- v.rubyify_keys! if v.is_a?(Hash)
10
- v.each{|p| p.rubyify_keys! if p.is_a?(Hash)} if v.is_a?(Array)
11
- }
12
- self
13
- end
14
-
15
- end
16
-
17
- class String
18
-
19
- # converts a camel_cased string to a underscore string,
20
- # Same way ActiveSupport does string.underscore
21
- def to_underscore!
22
- self.to_s.gsub(/::/, '/').
23
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
24
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
25
- tr("-", "_").
26
- downcase
27
- end
28
-
29
- end