tinderbot 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/tinderbot/cli/application.rb +6 -0
- data/lib/tinderbot/error.rb +4 -0
- data/lib/tinderbot/tinder/client.rb +17 -0
- data/lib/tinderbot/tinder/models/user.rb +4 -0
- data/lib/tinderbot/version.rb +1 -1
- data/spec/models/user_spec.rb +9 -0
- data/spec/tinder/client_spec.rb +22 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0b1dad2f25741d25506da64708cc3f69d28d0ca
|
4
|
+
data.tar.gz: 0fe61ce02894fd540ef5c1d11d18868beee4ff3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 823af092d67c3dcf228d287069b18b46278490dde1db484f205389ba303e007dff2aa373d062638a8f5229075ac97e234bd7567fc6d515c47b75b29f5a9e7396
|
7
|
+
data.tar.gz: ce02442f5e268715b347cbffe7d4399a72a648686048ed89fc0fee78dcb1184ef7177a35d208c8bdeef35055a5be2feb04b50e1fa62a7a343cb5355ff56f771b
|
data/README.md
CHANGED
@@ -69,6 +69,8 @@ tinder_client.updates #=> {...} original json from tinder's API
|
|
69
69
|
|
70
70
|
tinder_client.send_message(user_id, message)
|
71
71
|
|
72
|
+
tinder_client.update_location('40.7313029,-73.9884189')
|
73
|
+
|
72
74
|
# you can provide a user instance or a user id to like or dislike users
|
73
75
|
tinder_client.like(user)
|
74
76
|
tinder_client.like(user.id)
|
@@ -92,6 +94,7 @@ Commands:
|
|
92
94
|
tinderbot dislike USER_ID # Dislike user
|
93
95
|
tinderbot help [COMMAND] # Describe available commands or one specific command
|
94
96
|
tinderbot like USER_ID # Like user
|
97
|
+
tinderbot location # Update location using latitude and longitude. e.g. tinderbot location 40.7313029,-73.9884189
|
95
98
|
tinderbot profile # Get your profile data
|
96
99
|
tinderbot recommended # Get recommended users
|
97
100
|
tinderbot send USER_ID MESSAGE # Send message to user
|
@@ -47,6 +47,12 @@ module Tinderbot
|
|
47
47
|
puts tinder_client.send_message user_id, message
|
48
48
|
end
|
49
49
|
|
50
|
+
desc 'location', 'Update location using latitude and longitude. e.g. tinderbot location 40.7313029,-73.9884189'
|
51
|
+
def location(location)
|
52
|
+
tinder_client = sign_in
|
53
|
+
tinder_client.update_location(location)
|
54
|
+
end
|
55
|
+
|
50
56
|
desc 'autolike', 'Automatically like recommended people (Stops when there is no more people to like)'
|
51
57
|
def autolike
|
52
58
|
tinder_client = sign_in
|
@@ -61,6 +61,23 @@ module Tinderbot
|
|
61
61
|
puts "Sent message to #{user_id}" if @logs_enabled
|
62
62
|
end
|
63
63
|
|
64
|
+
def update_location(location)
|
65
|
+
latitude = location.split(',')[0]
|
66
|
+
longitude = location.split(',')[1]
|
67
|
+
|
68
|
+
if latitude && longitude
|
69
|
+
result = JSON.parse(@connection.post('user/ping', {lat: latitude, lon: longitude}).body)
|
70
|
+
|
71
|
+
if result['status'] == 200
|
72
|
+
puts "Location has been updated to #{location}" if @logs_enabled
|
73
|
+
else
|
74
|
+
puts result['error'] if @logs_enabled
|
75
|
+
end
|
76
|
+
else
|
77
|
+
raise Tinderbot::Error, 'Invalid location provided'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
64
81
|
protected
|
65
82
|
|
66
83
|
def like_from_user_id(user_id)
|
data/lib/tinderbot/version.rb
CHANGED
data/spec/models/user_spec.rb
CHANGED
@@ -22,4 +22,13 @@ describe Tinderbot::Tinder::Models::User do
|
|
22
22
|
it { expect(subject.gender).to eq :female }
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
describe '.to_yaml' do
|
27
|
+
let(:user_tinder_json) { JSON.parse(open('spec/fixtures/user.json').read)['results'] }
|
28
|
+
let(:user) { Tinderbot::Tinder::Models::User.build_from_tinder_json user_tinder_json }
|
29
|
+
|
30
|
+
subject { user.to_yaml }
|
31
|
+
|
32
|
+
it { should_not match('original_tinder_json') }
|
33
|
+
end
|
25
34
|
end
|
data/spec/tinder/client_spec.rb
CHANGED
@@ -101,4 +101,26 @@ describe Tinderbot::Tinder::Client do
|
|
101
101
|
|
102
102
|
it { tinder_client.send_message user_id, message }
|
103
103
|
end
|
104
|
+
|
105
|
+
describe '.update_location' do
|
106
|
+
context 'location is correct' do
|
107
|
+
let(:location) { '40.7313029,-73.9884189' }
|
108
|
+
let(:latitude) { location.split(',')[0] }
|
109
|
+
let(:longitude) { location.split(',')[1] }
|
110
|
+
let(:response) { '{"status":200}' }
|
111
|
+
|
112
|
+
before { expect(connection).to receive(:post).with('user/ping', {lat: latitude, lon: longitude}).and_return(connection) }
|
113
|
+
before { expect(connection).to receive(:body).and_return(response) }
|
114
|
+
|
115
|
+
it { tinder_client.update_location location }
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'one location is missing' do
|
119
|
+
let(:location) { '40.7313029' }
|
120
|
+
|
121
|
+
before { expect(connection).not_to receive(:post) }
|
122
|
+
|
123
|
+
it { expect(-> { tinder_client.update_location location }).to raise_error(Tinderbot::Error) }
|
124
|
+
end
|
125
|
+
end
|
104
126
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinderbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Venezia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- bin/tinderbot
|
140
140
|
- lib/tinderbot.rb
|
141
141
|
- lib/tinderbot/cli/application.rb
|
142
|
+
- lib/tinderbot/error.rb
|
142
143
|
- lib/tinderbot/facebook.rb
|
143
144
|
- lib/tinderbot/tinder/bot.rb
|
144
145
|
- lib/tinderbot/tinder/client.rb
|