thinknear 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -4
- data/Gemfile.lock +12 -10
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/think_near/connection.rb +2 -2
- data/lib/think_near.rb +1 -0
- data/spec/think_near/category_spec.rb +8 -0
- data/spec/think_near/client_spec.rb +4 -0
- data/spec/think_near/connection_spec.rb +4 -0
- data/spec/think_near/draw_spec.rb +10 -0
- data/spec/think_near/endpoint_spec.rb +4 -0
- data/spec/think_near/offer_spec.rb +8 -0
- data/thinknear.gemspec +27 -14
- metadata +38 -17
- data/spec/thinknear_spec.rb +0 -7
data/Gemfile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
gem 'oauth'
|
4
|
+
gem 'json'
|
4
5
|
|
5
6
|
group :development do
|
6
|
-
gem 'rspec'
|
7
|
-
gem 'bundler'
|
8
|
-
gem 'jeweler'
|
9
|
-
gem 'rcov'
|
7
|
+
gem 'rspec'
|
8
|
+
gem 'bundler'
|
9
|
+
gem 'jeweler'
|
10
|
+
gem 'rcov'
|
10
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -7,24 +7,26 @@ GEM
|
|
7
7
|
bundler (~> 1.0.0)
|
8
8
|
git (>= 1.2.5)
|
9
9
|
rake
|
10
|
+
json (1.5.1)
|
10
11
|
oauth (0.4.4)
|
11
12
|
rake (0.8.7)
|
12
13
|
rcov (0.9.9)
|
13
|
-
rspec (2.
|
14
|
-
rspec-core (~> 2.
|
15
|
-
rspec-expectations (~> 2.
|
16
|
-
rspec-mocks (~> 2.
|
17
|
-
rspec-core (2.
|
18
|
-
rspec-expectations (2.
|
14
|
+
rspec (2.5.0)
|
15
|
+
rspec-core (~> 2.5.0)
|
16
|
+
rspec-expectations (~> 2.5.0)
|
17
|
+
rspec-mocks (~> 2.5.0)
|
18
|
+
rspec-core (2.5.1)
|
19
|
+
rspec-expectations (2.5.0)
|
19
20
|
diff-lcs (~> 1.1.2)
|
20
|
-
rspec-mocks (2.
|
21
|
+
rspec-mocks (2.5.0)
|
21
22
|
|
22
23
|
PLATFORMS
|
23
24
|
ruby
|
24
25
|
|
25
26
|
DEPENDENCIES
|
26
|
-
bundler
|
27
|
-
jeweler
|
27
|
+
bundler
|
28
|
+
jeweler
|
29
|
+
json
|
28
30
|
oauth
|
29
31
|
rcov
|
30
|
-
rspec
|
32
|
+
rspec
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ require 'jeweler'
|
|
13
13
|
Jeweler::Tasks.new do |gem|
|
14
14
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
15
|
gem.name = "thinknear"
|
16
|
-
gem.homepage = "
|
16
|
+
gem.homepage = "https://github.com/ThinkNear/thinknear-ruby"
|
17
17
|
gem.license = "MIT"
|
18
18
|
gem.summary = %Q{A ThinkNear Ruby Client}
|
19
19
|
gem.email = "barushev@gmail.com"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'oauth'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module ThinkNear
|
4
5
|
class Connection
|
5
|
-
|
6
6
|
attr_accessor :debug
|
7
7
|
|
8
8
|
def initialize(token, secret)
|
@@ -22,7 +22,7 @@ module ThinkNear
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def request(method, endpoint, data)
|
25
|
-
headers = { 'User-Agent' =>
|
25
|
+
headers = { 'User-Agent' => "ThinkNear Ruby Client v#{VERSION}"}
|
26
26
|
|
27
27
|
if [:get].include?(method) && !data.nil?
|
28
28
|
endpoint = endpoint + '?' + build_query(data)
|
data/lib/think_near.rb
CHANGED
@@ -10,6 +10,7 @@ require 'think_near/offer'
|
|
10
10
|
module ThinkNear
|
11
11
|
API_VERSION = '1.0'.freeze
|
12
12
|
REALM = 'http://api-sandbox.thinknear.com'
|
13
|
+
VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
13
14
|
|
14
15
|
class ThinkNearError < StandardError; end
|
15
16
|
class Unauthorized < ThinkNearError; end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThinkNear::Draw do
|
4
|
+
describe "#attributes" do
|
5
|
+
it "returns attributes passed during initialization" do
|
6
|
+
attributes = { :category => 'Spa', :display_value => 'Manicure', :name => 'spa_manicure' }
|
7
|
+
described_class.new(attributes).attributes.should == attributes
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ThinkNear::Offer do
|
4
|
+
it "returns attributes passed during initialization" do
|
5
|
+
attributes = { :discount => '10%', :title => 'Spa 10% off', :id => 'WELL_SPA' }
|
6
|
+
described_class.new(attributes).attributes.should == attributes
|
7
|
+
end
|
8
|
+
end
|
data/thinknear.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{thinknear}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Denis Barushev"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-17}
|
13
13
|
s.email = %q{barushev@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -36,17 +36,27 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/think_near/offer.rb",
|
37
37
|
"lib/thinknear.rb",
|
38
38
|
"spec/spec_helper.rb",
|
39
|
-
"spec/
|
39
|
+
"spec/think_near/category_spec.rb",
|
40
|
+
"spec/think_near/client_spec.rb",
|
41
|
+
"spec/think_near/connection_spec.rb",
|
42
|
+
"spec/think_near/draw_spec.rb",
|
43
|
+
"spec/think_near/endpoint_spec.rb",
|
44
|
+
"spec/think_near/offer_spec.rb",
|
40
45
|
"thinknear.gemspec"
|
41
46
|
]
|
42
|
-
s.homepage = %q{
|
47
|
+
s.homepage = %q{https://github.com/ThinkNear/thinknear-ruby}
|
43
48
|
s.licenses = ["MIT"]
|
44
49
|
s.require_paths = ["lib"]
|
45
50
|
s.rubygems_version = %q{1.6.2}
|
46
51
|
s.summary = %q{A ThinkNear Ruby Client}
|
47
52
|
s.test_files = [
|
48
53
|
"spec/spec_helper.rb",
|
49
|
-
"spec/
|
54
|
+
"spec/think_near/category_spec.rb",
|
55
|
+
"spec/think_near/client_spec.rb",
|
56
|
+
"spec/think_near/connection_spec.rb",
|
57
|
+
"spec/think_near/draw_spec.rb",
|
58
|
+
"spec/think_near/endpoint_spec.rb",
|
59
|
+
"spec/think_near/offer_spec.rb"
|
50
60
|
]
|
51
61
|
|
52
62
|
if s.respond_to? :specification_version then
|
@@ -54,22 +64,25 @@ Gem::Specification.new do |s|
|
|
54
64
|
|
55
65
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
66
|
s.add_runtime_dependency(%q<oauth>, [">= 0"])
|
57
|
-
s.
|
58
|
-
s.add_development_dependency(%q<
|
59
|
-
s.add_development_dependency(%q<
|
67
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
70
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
60
71
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
61
72
|
else
|
62
73
|
s.add_dependency(%q<oauth>, [">= 0"])
|
63
|
-
s.add_dependency(%q<
|
64
|
-
s.add_dependency(%q<
|
65
|
-
s.add_dependency(%q<
|
74
|
+
s.add_dependency(%q<json>, [">= 0"])
|
75
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
76
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
77
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
66
78
|
s.add_dependency(%q<rcov>, [">= 0"])
|
67
79
|
end
|
68
80
|
else
|
69
81
|
s.add_dependency(%q<oauth>, [">= 0"])
|
70
|
-
s.add_dependency(%q<
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
82
|
+
s.add_dependency(%q<json>, [">= 0"])
|
83
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
84
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
85
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
73
86
|
s.add_dependency(%q<rcov>, [">= 0"])
|
74
87
|
end
|
75
88
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: thinknear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Denis Barushev
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-17 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,40 +25,40 @@ dependencies:
|
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: json
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
35
|
-
type: :
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
39
|
+
name: rspec
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: "0"
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
50
|
+
name: bundler
|
51
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: "0"
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: *id004
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: jeweler
|
62
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
@@ -68,6 +68,17 @@ dependencies:
|
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rcov
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
71
82
|
description:
|
72
83
|
email: barushev@gmail.com
|
73
84
|
executables: []
|
@@ -98,10 +109,15 @@ files:
|
|
98
109
|
- lib/think_near/offer.rb
|
99
110
|
- lib/thinknear.rb
|
100
111
|
- spec/spec_helper.rb
|
101
|
-
- spec/
|
112
|
+
- spec/think_near/category_spec.rb
|
113
|
+
- spec/think_near/client_spec.rb
|
114
|
+
- spec/think_near/connection_spec.rb
|
115
|
+
- spec/think_near/draw_spec.rb
|
116
|
+
- spec/think_near/endpoint_spec.rb
|
117
|
+
- spec/think_near/offer_spec.rb
|
102
118
|
- thinknear.gemspec
|
103
119
|
has_rdoc: true
|
104
|
-
homepage:
|
120
|
+
homepage: https://github.com/ThinkNear/thinknear-ruby
|
105
121
|
licenses:
|
106
122
|
- MIT
|
107
123
|
post_install_message:
|
@@ -114,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
130
|
requirements:
|
115
131
|
- - ">="
|
116
132
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
133
|
+
hash: -4536055797330078501
|
118
134
|
segments:
|
119
135
|
- 0
|
120
136
|
version: "0"
|
@@ -133,4 +149,9 @@ specification_version: 3
|
|
133
149
|
summary: A ThinkNear Ruby Client
|
134
150
|
test_files:
|
135
151
|
- spec/spec_helper.rb
|
136
|
-
- spec/
|
152
|
+
- spec/think_near/category_spec.rb
|
153
|
+
- spec/think_near/client_spec.rb
|
154
|
+
- spec/think_near/connection_spec.rb
|
155
|
+
- spec/think_near/draw_spec.rb
|
156
|
+
- spec/think_near/endpoint_spec.rb
|
157
|
+
- spec/think_near/offer_spec.rb
|