yelpr 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,13 +4,10 @@ require 'faraday_middleware'
4
4
  module Yelpr
5
5
  class Client
6
6
 
7
- def initialize(options = {})
8
- auth = {
9
- :consumer_key => options[:consumer_key],
10
- :consumer_secret => options[:consumer_secret],
11
- :token => options[:token],
12
- :token_secret => options[:token_secret]
13
- }
7
+ attr_accessor :consumer_key, :consumer_secret, :token, :token_secret
8
+
9
+ def initialize()
10
+ yield self
14
11
 
15
12
  @conn = Faraday.new(:url => 'http://api.yelp.com') do |builder|
16
13
  builder.use Faraday::Request::OAuth, auth if auth.values.all?
@@ -32,5 +29,16 @@ module Yelpr
32
29
  response = @conn.get "/v2/business/#{id}"
33
30
  response.body
34
31
  end
32
+
33
+ private
34
+
35
+ def auth
36
+ {
37
+ :consumer_key => @consumer_key,
38
+ :consumer_secret => @consumer_secret,
39
+ :token => @token,
40
+ :token_secret => @token_secret
41
+ }
42
+ end
35
43
  end
36
44
  end
@@ -1,3 +1,3 @@
1
1
  module Yelpr
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -6,12 +6,12 @@ describe Yelpr::Client do
6
6
 
7
7
  before do
8
8
  VCR.insert_cassette(__name__, :record => :new_episodes)
9
- @client = Yelpr::Client.new(
10
- :consumer_key => 'i0dj2IWqCUY_A_0ZotwPtQ',
11
- :consumer_secret => 'z6tUShId0oPctG5po6I_D16Ld8M',
12
- :token => 'dJN9A1_-TNJoXNcOuk3xgn4AVJze-nU5',
13
- :token_secret => '6Pr0C98rHNlfT23APD12TV-b5Eg'
14
- )
9
+ @client = Yelpr::Client.new do |c|
10
+ c.consumer_key = 'consumer_key'
11
+ c.consumer_secret = 'consumer_secret'
12
+ c.token = 'token'
13
+ c.token_secret = 'token_secret'
14
+ end
15
15
  end
16
16
 
17
17
  after do
@@ -20,7 +20,7 @@ describe Yelpr::Client do
20
20
 
21
21
  describe "when created" do
22
22
  it 'gets an error response if OAuth credentials are missing' do
23
- noauth_client = Yelpr::Client.new
23
+ noauth_client = Yelpr::Client.new { }
24
24
  response = noauth_client.search
25
25
  response.error.text.must_match /One or more parameters are missing in request/
26
26
  response.error.id.must_match /MISSING_PARAMETER/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yelpr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-26 00:00:00.000000000Z
12
+ date: 2011-12-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: webmock
16
- requirement: &70218731032480 !ruby/object:Gem::Requirement
16
+ requirement: &81131710 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70218731032480
24
+ version_requirements: *81131710
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70218731032040 !ruby/object:Gem::Requirement
27
+ requirement: &81131490 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70218731032040
35
+ version_requirements: *81131490
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
38
- requirement: &70218731031580 !ruby/object:Gem::Requirement
38
+ requirement: &81131270 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70218731031580
46
+ version_requirements: *81131270
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: vcr
49
- requirement: &70218731031160 !ruby/object:Gem::Requirement
49
+ requirement: &81131050 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70218731031160
57
+ version_requirements: *81131050
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: faraday
60
- requirement: &70218731030700 !ruby/object:Gem::Requirement
60
+ requirement: &81130830 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70218731030700
68
+ version_requirements: *81130830
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: faraday_middleware
71
- requirement: &70218731030280 !ruby/object:Gem::Requirement
71
+ requirement: &81051840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70218731030280
79
+ version_requirements: *81051840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: hashie
82
- requirement: &70218731029860 !ruby/object:Gem::Requirement
82
+ requirement: &81051570 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70218731029860
90
+ version_requirements: *81051570
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: multi_json
93
- requirement: &70218731029440 !ruby/object:Gem::Requirement
93
+ requirement: &81051290 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70218731029440
101
+ version_requirements: *81051290
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: simple_oauth
104
- requirement: &70218731029020 !ruby/object:Gem::Requirement
104
+ requirement: &81051080 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70218731029020
112
+ version_requirements: *81051080
113
113
  description: Yelp gem for the masses.
114
114
  email:
115
115
  - justinvbeltran@gmail.com
@@ -157,7 +157,4 @@ rubygems_version: 1.8.10
157
157
  signing_key:
158
158
  specification_version: 3
159
159
  summary: Yelp API v2.0 Ruby gem
160
- test_files:
161
- - spec/spec_helper.rb
162
- - spec/support/vcr.rb
163
- - spec/yelpr/client_spec.rb
160
+ test_files: []