tinderbot 0.0.10 → 0.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7996ea7e4ff30a49b7ad49ab8406297e99f2e69e
4
- data.tar.gz: cdcd1fca2d274daf3502bd9158a86c7a6351981d
3
+ metadata.gz: 4f15c6d4f351a3dcbdc6015ef8db68fb2e59cf04
4
+ data.tar.gz: e4f70c97e2eb3c4c2fcb85fbaf4a94d932922f1c
5
5
  SHA512:
6
- metadata.gz: c26988c78c633378fd7def83ae8ac253d59ff35766777f04eae3966a12722eb13add88032d461cb3ae39069f55525813bc7f0960e824519c688d08516af08729
7
- data.tar.gz: bcdccdc21ecd381ccef1946b60e43e4d5ee3441937fd261c276226bce26b781a5caf508b64fae070d52975f57d2fcfaa7f59827063cdf7068c3c33ed46589f97
6
+ metadata.gz: a76748c82c2d987b35014e3ce90b3be20b155555228d54d7d0ba5e972eac83ac65353644db3da761902d1a8467afc8a485e6a1b9328e2451e47bfa3bb885bff4
7
+ data.tar.gz: 4bc4e04e4db803aaaf2f85b7f40b40017526107f2a115d4e5ee0c35d0f3e79c23853ea11cf8484d4a0efe13e9ed3c8eb4c907cb92d698e1586bcf9fada3fa000
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
3
+ - 2.1.3
data/README.md CHANGED
@@ -35,7 +35,7 @@ Tinderbot also provides a script to get your facebook credentials.
35
35
  facebook_email = 'your facebook email'
36
36
  facebook_password = 'your facebook password'
37
37
 
38
- facebook_authentication_token, facebook_user_id = Tinderbot::Facebook.get_credentials(facebook_email, facebook_password)
38
+ facebook_authentication_token, facebook_user_id = Tinderbot::Facebook.get_credentials facebook_email, facebook_password
39
39
  ```
40
40
 
41
41
  ## Usage
@@ -47,7 +47,7 @@ facebook_authentication_token = 'your facebook authentication token'
47
47
  facebook_user_id = 'your facebook user id'
48
48
 
49
49
  tinder_client = Tinderbot::Client.new
50
- tinder_authentication_token = tinder_client.get_authentication_token(facebook_authentication_token, facebook_user_id)
50
+ tinder_authentication_token = tinder_client.get_authentication_token facebook_authentication_token, facebook_user_id
51
51
  tinder_client.sign_in tinder_authentication_token
52
52
  ```
53
53
 
@@ -62,27 +62,27 @@ user.birth_date #=> #<Date: 2014-05-01>
62
62
  user.gender #=> :male (or :female)
63
63
  user.photo_urls #=> ['http://photo_1_url.jpg', 'http://photo_2_url.jpg']
64
64
 
65
- user = tinder_client.user(user_id) #=> returns an instance of Tinderbot::Model::User
65
+ user = tinder_client.user user_id #=> returns an instance of Tinderbot::Model::User
66
66
 
67
67
  users = tinder_client.recommended_users #=> returns an array of Tinderbot::Model::User instances
68
68
 
69
69
  tinder_client.updates #=> {...} original json from tinder's API
70
70
 
71
- tinder_client.send_message(user_id, message)
71
+ tinder_client.send_message user_id, message
72
72
 
73
- tinder_client.update_location('40.7313029,-73.9884189')
73
+ tinder_client.update_location '40.7313029,-73.9884189'
74
74
 
75
75
  # you can provide a user instance or a user id to like or dislike users
76
- tinder_client.like(user)
77
- tinder_client.like(user.id)
78
- tinder_client.dislike(user)
79
- tinder_client.dislike(user.id)
76
+ tinder_client.like user
77
+ tinder_client.like user.id
78
+ tinder_client.dislike user
79
+ tinder_client.dislike user.id
80
80
  ```
81
81
 
82
82
  ### Using the bot
83
83
  Tinderbot provides a simple bot which automatically likes all recommended people. It stops when there is no more recommended people.
84
84
  ```ruby
85
- tinder_bot = Tinderbot::Tinder::Bot.new tinder_client
85
+ tinder_bot = Tinderbot::Bot.new tinder_client
86
86
  tinder_bot.like_recommended_users
87
87
  ```
88
88
 
@@ -91,16 +91,16 @@ You can interact with Tinderbot with command lines.
91
91
  ```
92
92
  > tinderbot
93
93
  Commands:
94
- tinderbot autolike # Automatically like recommended people (Stops when there is no more people to like)
95
- tinderbot dislike USER_ID # Dislike user
96
- tinderbot help [COMMAND] # Describe available commands or one specific command
97
- tinderbot like USER_ID # Like user
98
- tinderbot location # Update location using latitude and longitude. e.g. tinderbot location 40.7313029,-73.9884189
99
- tinderbot profile # Get your profile data
100
- tinderbot recommended # Get recommended users
101
- tinderbot send USER_ID MESSAGE # Send message to user
102
- tinderbot updates # Get updates
103
- tinderbot user USER_ID # Get user profile data
94
+ tinderbot autolike # Automatically like recommended people (Stops when there is no more people to like)
95
+ tinderbot dislike USER_ID # Dislike user
96
+ tinderbot help [COMMAND] # Describe available commands or one specific command
97
+ tinderbot like USER_ID # Like user
98
+ tinderbot location ALTITUDE,LONGITUDE # Update location using latitude and longitude, e.g. tinderbot location 40.7313029,-73.9884189
99
+ tinderbot profile # Get your profile data
100
+ tinderbot recommended # Get recommended users
101
+ tinderbot send USER_ID MESSAGE # Send message to user
102
+ tinderbot updates # Get updates
103
+ tinderbot user USER_ID # Get user profile data
104
104
  ```
105
105
 
106
106
  ## Contributing
@@ -47,7 +47,7 @@ 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'
50
+ desc 'location ALTITUDE,LONGITUDE', 'Update location using latitude and longitude, e.g. tinderbot location 40.7313029,-73.9884189'
51
51
  def location(location)
52
52
  tinder_client = sign_in
53
53
  tinder_client.update_location(location)
@@ -32,7 +32,8 @@ module Tinderbot
32
32
  end
33
33
 
34
34
  def recommended_users
35
- JSON.parse(@connection.post('user/recs').body)['results'].map { |r| Tinderbot::Model::User.build_from_tinder_json r }
35
+ json_results = JSON.parse(@connection.post('user/recs').body)['results']
36
+ json_results.map { |r| Tinderbot::Model::User.build_from_tinder_json r } if json_results
36
37
  end
37
38
 
38
39
  def like(user_or_user_id)
@@ -1,3 +1,3 @@
1
1
  module Tinderbot
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -0,0 +1 @@
1
+ { "message": "recs timeout" }
@@ -46,13 +46,23 @@ describe Tinderbot::Client do
46
46
 
47
47
  describe '.recommended_users' do
48
48
  let(:recommended_users_tinder_raw_json) { open('spec/fixtures/recommended_users.json').read }
49
-
49
+
50
50
  before { expect(connection).to receive(:post).with('user/recs').and_return(connection) }
51
51
  before { expect(connection).to receive(:body).and_return(recommended_users_tinder_raw_json) }
52
-
52
+
53
53
  subject { tinder_client.recommended_users }
54
+
55
+ context 'with recommended_users' do
56
+ let(:recommended_users_tinder_raw_json) { open('spec/fixtures/recommended_users.json').read }
57
+
58
+ it { should eq JSON.parse(recommended_users_tinder_raw_json)['results'].map { |r| Tinderbot::Model::User.build_from_tinder_json r } }
59
+ end
60
+
61
+ context 'with timeout from tinder API' do
62
+ let(:recommended_users_tinder_raw_json) { open('spec/fixtures/timeout_recommended_users.json').read }
54
63
 
55
- it { should eq JSON.parse(recommended_users_tinder_raw_json)['results'].map { |r| Tinderbot::Model::User.build_from_tinder_json r } }
64
+ it { should be nil }
65
+ end
56
66
  end
57
67
 
58
68
  describe '.like' do
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.10
4
+ version: 0.0.11
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-09-02 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -161,6 +161,7 @@ files:
161
161
  - lib/tinderbot/version.rb
162
162
  - spec/fixtures/profile.json
163
163
  - spec/fixtures/recommended_users.json
164
+ - spec/fixtures/timeout_recommended_users.json
164
165
  - spec/fixtures/updates.json
165
166
  - spec/fixtures/user.json
166
167
  - spec/models/user_spec.rb
@@ -195,6 +196,7 @@ summary: Ruby wrapper for the Tinder API and automatic liker bot.
195
196
  test_files:
196
197
  - spec/fixtures/profile.json
197
198
  - spec/fixtures/recommended_users.json
199
+ - spec/fixtures/timeout_recommended_users.json
198
200
  - spec/fixtures/updates.json
199
201
  - spec/fixtures/user.json
200
202
  - spec/models/user_spec.rb