yelp-fusion 0.2.1.pre.beta → 0.3.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rubocop_todo.yml +3 -0
- data/Gemfile +1 -1
- data/README.md +19 -11
- data/lib/yelp/fusion.rb +2 -2
- data/lib/yelp/fusion/client.rb +6 -2
- data/lib/yelp/fusion/configuration.rb +1 -1
- data/lib/yelp/fusion/endpoint/business.rb +1 -1
- data/lib/yelp/fusion/endpoint/match.rb +1 -1
- data/lib/yelp/fusion/endpoint/phone.rb +1 -1
- data/lib/yelp/fusion/endpoint/review.rb +1 -1
- data/lib/yelp/fusion/endpoint/search.rb +1 -1
- data/lib/yelp/fusion/endpoint/transaction.rb +1 -1
- data/lib/yelp/fusion/error.rb +2 -1
- data/lib/yelp/fusion/responses/base.rb +1 -1
- data/lib/yelp/fusion/responses/business.rb +1 -1
- data/lib/yelp/fusion/responses/match.rb +1 -1
- data/lib/yelp/fusion/responses/models/business.rb +1 -1
- data/lib/yelp/fusion/responses/models/categories.rb +1 -1
- data/lib/yelp/fusion/responses/models/center.rb +1 -1
- data/lib/yelp/fusion/responses/models/hours.rb +1 -1
- data/lib/yelp/fusion/responses/models/location.rb +1 -1
- data/lib/yelp/fusion/responses/models/openHours.rb +1 -1
- data/lib/yelp/fusion/responses/models/region.rb +1 -1
- data/lib/yelp/fusion/responses/models/reviews.rb +1 -1
- data/lib/yelp/fusion/responses/models/user.rb +1 -1
- data/lib/yelp/fusion/responses/phone.rb +1 -1
- data/lib/yelp/fusion/responses/review.rb +1 -1
- data/lib/yelp/fusion/responses/search.rb +1 -1
- data/lib/yelp/fusion/responses/transaction.rb +1 -1
- data/lib/yelp/fusion/singleton.rb +40 -0
- data/lib/yelp/fusion/version.rb +2 -2
- data/yelp-fusion.gemspec +11 -6
- metadata +77 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5437582e9eab689df423b49eb43b5ced2095721b47259bae3b020ddf9c7a1957
|
4
|
+
data.tar.gz: f4bf9851941bb4aeac86e2c0c0767842c568e9a7d84e45b8c6bcba90ff8ccfb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0828a9f1e896785adf2559390abea8effd80dc8bf2bd7a8a46d8d4012b1b6521702f832bffcb5a4f3adfefdfddb921317aa976d224cf0a5e1686c9986518f06b'
|
7
|
+
data.tar.gz: 9534d9266d817e5602dd25a2572d0a92d2b73e44f0e33b2182b2b4c2e3be26b81e85e733114b25667afd3cac064b3c78406261c3ceba474f9130ecbb97df2866
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,24 +4,32 @@ This is a Ruby Gem for the Yelp API. It'll simplify the process of consuming dat
|
|
4
4
|
|
5
5
|
This library is in Beta and should be used for testing purposes only.
|
6
6
|
|
7
|
-
Please remember to read and follow the [Terms of Use](https://www.yelp.com/developers/api_terms) and [display requirements](https://www.yelp.com/developers/display_requirements)before creating your applications.
|
7
|
+
Please remember to read and follow the [Terms of Use](https://www.yelp.com/developers/api_terms) and [display requirements](https://www.yelp.com/developers/display_requirements) before creating your applications.
|
8
8
|
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
Add this line to your application's Gemfile:
|
12
|
+
Add this line to your Rails application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'yelp-fusion',
|
15
|
+
gem 'yelp-fusion', '0.3-beta'
|
16
16
|
```
|
17
17
|
|
18
|
+
Add this line to your Ruby appliation's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'yelp-fusion', require: 'yelp/fusion'
|
22
|
+
```
|
23
|
+
|
24
|
+
|
25
|
+
|
18
26
|
And then execute:
|
19
27
|
|
20
28
|
$ bundle
|
21
29
|
|
22
30
|
Or install it yourself as:
|
23
31
|
|
24
|
-
$ gem install yelp-fusion
|
32
|
+
$ gem install yelp-fusion --pre
|
25
33
|
|
26
34
|
## Usage
|
27
35
|
|
@@ -30,7 +38,7 @@ Or install it yourself as:
|
|
30
38
|
The gem uses a client model to query against the API. You create and configure a client with your API keys and make requests through that.
|
31
39
|
|
32
40
|
```ruby
|
33
|
-
require 'yelp
|
41
|
+
require 'yelp/fusion'
|
34
42
|
|
35
43
|
client = Yelp::Fusion::Client.new(YOUR_API_KEY)
|
36
44
|
```
|
@@ -40,7 +48,7 @@ block, and access a client singleton using `Yelp::Fusion.client`. If you intend
|
|
40
48
|
use the gem with Rails, the client should be configured in an initializer.
|
41
49
|
|
42
50
|
```ruby
|
43
|
-
require 'yelp
|
51
|
+
require 'yelp/fusion'
|
44
52
|
|
45
53
|
configuration = Yelp.client.configure do |config|
|
46
54
|
config.api_key = YOUR_API_KEY
|
@@ -98,7 +106,7 @@ client.phone_search('+15555555555')
|
|
98
106
|
|
99
107
|
### [Review Details API](https://www.yelp.com/developers/documentation/v3/business_reviews)
|
100
108
|
|
101
|
-
To find all of the reviews for a business, use ``#review`` with a business ID.
|
109
|
+
To find all of the reviews for a business, use ``#review`` with a business ID.
|
102
110
|
|
103
111
|
```ruby
|
104
112
|
client.review('lJAGnYzku5zSaLnQ_T6_GQ')
|
@@ -106,7 +114,7 @@ client.review('lJAGnYzku5zSaLnQ_T6_GQ')
|
|
106
114
|
|
107
115
|
### [Transaction Details API](https://www.yelp.com/developers/documentation/v3/transaction_search)
|
108
116
|
|
109
|
-
To find all of the reviews for a business, use ``#transaction`` with ``'deliver'`` and a business ID.
|
117
|
+
To find all of the reviews for a business, use ``#transaction`` with ``'deliver'`` and a business ID.
|
110
118
|
|
111
119
|
```ruby
|
112
120
|
client.transaction_search('delivery', {location: 'San Francisco'})
|
@@ -114,7 +122,7 @@ client.transaction_search('delivery', {location: 'San Francisco'})
|
|
114
122
|
|
115
123
|
### [Match Details API](https://www.yelp.com/developers/documentation/v3/business_match)
|
116
124
|
|
117
|
-
To find all of the reviews for a business, use ``#match`` with a business ID.
|
125
|
+
To find all of the reviews for a business, use ``#match`` with a business ID.
|
118
126
|
|
119
127
|
```ruby
|
120
128
|
client.match({name: 'swissbakers', address1: '168 Western Ave', city: 'allston', state: 'MA', country: 'US'})
|
@@ -158,9 +166,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
158
166
|
|
159
167
|
## Contributing
|
160
168
|
|
161
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
169
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/erikgrueter1/yelp-fusion. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
162
170
|
|
163
|
-
1. Fork it (
|
171
|
+
1. Fork it ( https://github.com/erikgrueter1/yelp-fusion/fork )
|
164
172
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
165
173
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
166
174
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/yelp/fusion.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) Jobcase, Inc. All rights reserved.
|
1
|
+
# Copyright (c) Jobcase, Inc. All rights reserved.
|
2
2
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -33,4 +33,4 @@ module Yelp
|
|
33
33
|
@client ||= Yelp::Fusion::Client.new
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
data/lib/yelp/fusion/client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) Jobcase, Inc. All rights reserved.
|
1
|
+
# Copyright (c) Jobcase, Inc. All rights reserved.
|
2
2
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -27,10 +27,12 @@ require 'yelp/fusion/endpoint/business'
|
|
27
27
|
require 'yelp/fusion/endpoint/phone'
|
28
28
|
require 'yelp/fusion/endpoint/match'
|
29
29
|
require 'yelp/fusion/endpoint/transaction'
|
30
|
+
require 'yelp/fusion/singleton'
|
30
31
|
|
31
32
|
module Yelp
|
32
33
|
module Fusion
|
33
34
|
class Client
|
35
|
+
include Fusion::Singleton
|
34
36
|
API_HOST = 'https://api.yelp.com'.freeze
|
35
37
|
|
36
38
|
attr_accessor :configuration
|
@@ -38,8 +40,10 @@ module Yelp
|
|
38
40
|
# Creates an instance of the fusion client
|
39
41
|
# @param options [String, nil] a consumer key
|
40
42
|
# @return [Client] a new client initialized with the keys
|
43
|
+
|
41
44
|
def initialize(option = nil)
|
42
45
|
@configuration = nil
|
46
|
+
define_request_methods
|
43
47
|
return if option.nil?
|
44
48
|
@configuration = Configuration.new(option)
|
45
49
|
end
|
@@ -83,4 +87,4 @@ module Yelp
|
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
86
|
-
end
|
90
|
+
end
|
data/lib/yelp/fusion/error.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) Jobcase, Inc. All rights reserved.
|
1
|
+
# Copyright (c) Jobcase, Inc. All rights reserved.
|
2
2
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -100,6 +100,7 @@ module Yelp
|
|
100
100
|
class AccessLimitReached < Base; end
|
101
101
|
class NotFound < Base; end
|
102
102
|
class ClientError < Base; end
|
103
|
+
class BusinessNotFound < Base; end
|
103
104
|
end
|
104
105
|
end
|
105
106
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Yelp
|
2
|
+
module Fusion
|
3
|
+
module Singleton
|
4
|
+
REQUEST_CLASSES = [Yelp::Fusion::Endpoint::Search,
|
5
|
+
Yelp::Fusion::Endpoint::Business,
|
6
|
+
Yelp::Fusion::Endpoint::Phone,
|
7
|
+
Yelp::Fusion::Endpoint::Review,
|
8
|
+
Yelp::Fusion::Endpoint::Transaction,
|
9
|
+
Yelp::Fusion::Endpoint::Match].freeze
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# This goes through each endpoint class and creates singleton methods
|
14
|
+
# on the client that query those classes. We do this to avoid possible
|
15
|
+
# namespace collisions in the future when adding new classes
|
16
|
+
def define_request_methods
|
17
|
+
REQUEST_CLASSES.each do |request_class|
|
18
|
+
endpoint_instance = request_class.new(self)
|
19
|
+
create_methods_from_instance(endpoint_instance)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Loop through all of the endpoint instances' public singleton methods to
|
24
|
+
# add the method to client
|
25
|
+
def create_methods_from_instance(instance)
|
26
|
+
instance.public_methods(false).each do |method_name|
|
27
|
+
add_method(instance, method_name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Define the method on the client and send it to the endpoint instance
|
32
|
+
# with the args passed in
|
33
|
+
def add_method(instance, method_name)
|
34
|
+
define_singleton_method(method_name) do |*args|
|
35
|
+
instance.public_send(method_name, *args)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/yelp/fusion/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) Jobcase, Inc. All rights reserved.
|
1
|
+
# Copyright (c) Jobcase, Inc. All rights reserved.
|
2
2
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -20,6 +20,6 @@
|
|
20
20
|
|
21
21
|
module Yelp
|
22
22
|
module Fusion
|
23
|
-
VERSION = '0.
|
23
|
+
VERSION = '0.3-beta'.freeze
|
24
24
|
end
|
25
25
|
end
|
data/yelp-fusion.gemspec
CHANGED
@@ -7,12 +7,11 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'yelp-fusion'
|
8
8
|
spec.version = Yelp::Fusion::VERSION
|
9
9
|
spec.authors = ['Erik Grueter', 'Lyra Katzman']
|
10
|
-
spec.email = ['
|
10
|
+
spec.email = ['egrueter@jobcase.com', 'lkatzman@jobcase.com']
|
11
11
|
|
12
|
-
spec.summary = '{A Ruby gem for the Yelp Fusion (V3) API
|
13
|
-
spec.description = '{A Ruby gem for the Yelp
|
14
|
-
|
15
|
-
spec.homepage = 'http://www.google.com'
|
12
|
+
spec.summary = '{A Ruby gem for the Yelp Fusion (V3) API}'
|
13
|
+
spec.description = '{A Ruby gem for the Yelp Fusion (v3) API.}'
|
14
|
+
spec.homepage = 'https://github.com/erikgrueter1/yelp-fusion'
|
16
15
|
spec.license = 'MIT'
|
17
16
|
|
18
17
|
# Prevent pushing this gem to RubyGems.org.
|
@@ -20,7 +19,8 @@ Gem::Specification.new do |spec|
|
|
20
19
|
# to allow pushing to a single host or
|
21
20
|
# delete this section to allow pushing to any host.
|
22
21
|
# if spec.respond_to?(:metadata)
|
23
|
-
# spec.metadata['allowed_push_host'] =
|
22
|
+
# spec.metadata['allowed_push_host'] =
|
23
|
+
# "TODO: Set to 'http://mygemserver.com'"
|
24
24
|
# else
|
25
25
|
# raise 'RubyGems 2.0 or newer is required to protect against ' \
|
26
26
|
# 'public gem pushes.'
|
@@ -35,9 +35,14 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.required_ruby_version = '>= 2.2.2'
|
36
36
|
|
37
37
|
spec.add_development_dependency 'bundler', '~> 1.15'
|
38
|
+
spec.add_development_dependency 'faraday_middleware', '~> 0.12.2'
|
38
39
|
spec.add_development_dependency 'pry', '~> 0.11.3'
|
39
40
|
spec.add_development_dependency 'pry-coolline', '~> 0.2.5'
|
40
41
|
spec.add_development_dependency 'rake', '~> 10.0'
|
42
|
+
spec.add_development_dependency 'rubocop', '~> 0.58'
|
43
|
+
spec.add_development_dependency 'simplecov', '~> 0.16.0'
|
44
|
+
spec.add_development_dependency 'vcr', '~> 4.0'
|
45
|
+
spec.add_development_dependency 'webmock', '~> 3.4.2'
|
41
46
|
|
42
47
|
spec.add_dependency 'faraday', '~> 0.15.2'
|
43
48
|
spec.add_dependency 'faraday_middleware', '~> 0.12.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yelp-fusion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.pre.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Grueter
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-07-
|
12
|
+
date: 2018-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.15'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: faraday_middleware
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.12.2
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.12.2
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: pry
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +81,62 @@ dependencies:
|
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
83
|
version: '10.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rubocop
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.58'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.58'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: simplecov
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.16.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.16.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: vcr
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '4.0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '4.0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: webmock
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 3.4.2
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 3.4.2
|
70
140
|
- !ruby/object:Gem::Dependency
|
71
141
|
name: faraday
|
72
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,11 +179,9 @@ dependencies:
|
|
109
179
|
- - ">="
|
110
180
|
- !ruby/object:Gem::Version
|
111
181
|
version: 4.2.0
|
112
|
-
description:
|
113
|
-
{A Ruby gem for the Yelp Fucsion (v3) API.
|
114
|
-
It is built to support future versions}
|
182
|
+
description: "{A Ruby gem for the Yelp Fusion (v3) API.}"
|
115
183
|
email:
|
116
|
-
-
|
184
|
+
- egrueter@jobcase.com
|
117
185
|
- lkatzman@jobcase.com
|
118
186
|
executables: []
|
119
187
|
extensions: []
|
@@ -163,9 +231,10 @@ files:
|
|
163
231
|
- lib/yelp/fusion/responses/review.rb
|
164
232
|
- lib/yelp/fusion/responses/search.rb
|
165
233
|
- lib/yelp/fusion/responses/transaction.rb
|
234
|
+
- lib/yelp/fusion/singleton.rb
|
166
235
|
- lib/yelp/fusion/version.rb
|
167
236
|
- yelp-fusion.gemspec
|
168
|
-
homepage:
|
237
|
+
homepage: https://github.com/erikgrueter1/yelp-fusion
|
169
238
|
licenses:
|
170
239
|
- MIT
|
171
240
|
metadata: {}
|
@@ -188,5 +257,5 @@ rubyforge_project:
|
|
188
257
|
rubygems_version: 2.7.6
|
189
258
|
signing_key:
|
190
259
|
specification_version: 4
|
191
|
-
summary: "{A Ruby gem for the Yelp Fusion (V3) API
|
260
|
+
summary: "{A Ruby gem for the Yelp Fusion (V3) API}"
|
192
261
|
test_files: []
|