tindy 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tindy.rb +0 -5
- data/lib/tindy/client.rb +50 -33
- metadata +14 -57
- data/.gitignore +0 -73
- data/.rubocop.yml +0 -18
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -43
- data/LICENSE +0 -21
- data/README.md +0 -105
- data/Rakefile +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/tindy/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 623d78001a934a7fb581f83881c1175d323974a2f0a983d848987f278980b7a3
|
4
|
+
data.tar.gz: eef27325149f877fc1bf5137dcbbd6f706b34c7ab05f02ebc78107afc4a67749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d617a05c8ca267dedc05ad3fa63d0520cfec3a38d63100ea51be26e0df0e15b54e2f26e3416255b6f5531115d513e31bf10bebff9088cdacb7cea12dbf96f49
|
7
|
+
data.tar.gz: 8b2e79c590ac1c64fb8bb865ea2462e257aa143b36ea2601eadc7fa44ea11f46aa5e9357d96d4e126eb5af6c58831347c70fe46edee69e5cced98d4eb1ca802b
|
data/lib/tindy.rb
CHANGED
data/lib/tindy/client.rb
CHANGED
@@ -2,8 +2,9 @@ module Tindy
|
|
2
2
|
class Client
|
3
3
|
include HTTParty
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
base_uri "https://api.gotinder.com"
|
6
|
+
|
7
|
+
TINDER_APP_ID = "464891386855067".freeze
|
7
8
|
|
8
9
|
REPORT_OPTIONS = {
|
9
10
|
spam: 1,
|
@@ -17,43 +18,57 @@ module Tindy
|
|
17
18
|
}.freeze
|
18
19
|
|
19
20
|
def initialize(fb_token)
|
20
|
-
@
|
21
|
+
@fb_token = fb_token
|
22
|
+
@tinder_token = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def authenticate!
|
26
|
+
return if authenticated?
|
27
|
+
|
28
|
+
auth_obj = {
|
29
|
+
facebook_token: @fb_token,
|
30
|
+
facebook_id: TINDER_APP_ID
|
31
|
+
}.to_json
|
32
|
+
|
33
|
+
res = self.class.post("/auth", headers: headers, body: auth_obj)
|
34
|
+
|
35
|
+
raise "Failed to authenticate. Response body: #{res.body}" if res.code != 200
|
36
|
+
|
37
|
+
@tinder_token = JSON.parse(res.body)["token"]
|
21
38
|
end
|
22
39
|
|
23
40
|
def like(id)
|
24
41
|
post("/like/#{id}")
|
25
42
|
end
|
26
43
|
|
27
|
-
def pass
|
44
|
+
def pass(id)
|
28
45
|
post("/pass/#{id}")
|
29
46
|
end
|
30
47
|
|
31
48
|
def updates
|
32
|
-
post(
|
49
|
+
post("/updates", { last_activity_date: "" })
|
33
50
|
end
|
34
51
|
|
35
52
|
def recommendations
|
36
|
-
post(
|
53
|
+
post("/recs")
|
37
54
|
end
|
38
55
|
|
39
56
|
def report_user(id, cause)
|
40
|
-
raise
|
57
|
+
raise "Incorrect cause provided (:spam, :offensive/:inappropriate)" unless REPORT_OPTIONS.key?(cause)
|
41
58
|
|
42
|
-
post("/report/#{id}", { cause: REPORT_OPTIONS
|
59
|
+
post("/report/#{id}", { cause: REPORT_OPTIONS[cause] })
|
43
60
|
end
|
44
61
|
|
45
62
|
def send_message(id, message)
|
46
|
-
post("/matches/#{id}", { message: message }
|
63
|
+
post("/matches/#{id}", { message: message })
|
47
64
|
end
|
48
65
|
|
49
66
|
def update_location(latitude, longitude)
|
50
|
-
post(
|
67
|
+
post("/user/ping", { lat: latitude, lon: longitude })
|
51
68
|
end
|
52
69
|
|
53
70
|
def update_gender(gender)
|
54
|
-
|
55
|
-
|
56
|
-
update_profile(gender: GENDER_OPTIONS.dig(gender))
|
71
|
+
update_profile(gender: gender)
|
57
72
|
end
|
58
73
|
|
59
74
|
def update_min_age(age)
|
@@ -69,37 +84,39 @@ module Tindy
|
|
69
84
|
end
|
70
85
|
|
71
86
|
def update_profile(options = {})
|
72
|
-
|
87
|
+
gender_option = options[:gender]
|
88
|
+
validate_gender!(gender_option)
|
89
|
+
|
90
|
+
options.merge!(gender: GENDER_OPTIONS[gender_option]) if gender_option.is_a?(Symbol)
|
91
|
+
|
92
|
+
post("/profile", options)
|
73
93
|
end
|
74
94
|
|
75
95
|
private
|
76
|
-
def authenticate(fb_token)
|
77
|
-
auth_obj = {
|
78
|
-
facebook_token: fb_token,
|
79
|
-
facebook_id: TINDER_APP_ID
|
80
|
-
}.to_json
|
81
96
|
|
82
|
-
|
97
|
+
def authenticated?
|
98
|
+
!!@tinder_token
|
99
|
+
end
|
83
100
|
|
84
|
-
|
101
|
+
def validate_gender!(gender)
|
102
|
+
return if gender.nil?
|
103
|
+
return if (GENDER_OPTIONS.keys + GENDER_OPTIONS.values).include?(gender)
|
85
104
|
|
86
|
-
|
105
|
+
raise "Invalid argument passed for gender (:male, :female, 0, 1) '#{gender}'"
|
87
106
|
end
|
88
107
|
|
89
|
-
def post(path, body
|
90
|
-
|
91
|
-
|
108
|
+
def post(path, body)
|
109
|
+
raise "Not authenticated!" unless authenticated?
|
110
|
+
|
111
|
+
self.class.post(path, headers: headers, body: body.to_json).parsed_response
|
92
112
|
end
|
93
113
|
|
94
114
|
def headers
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
headers['platform'] = 'ios'
|
101
|
-
|
102
|
-
headers
|
115
|
+
{
|
116
|
+
"content-type" => "application/json",
|
117
|
+
"User-agent" => "Tinder/4.0.9 (iPhone; iOS 8.1.1; Scale/2.00)",
|
118
|
+
"platform" => "ios"
|
119
|
+
}.tap { |h| h["X-Auth-Token"] = @tinder_token if authenticated? }
|
103
120
|
end
|
104
121
|
end
|
105
122
|
end
|
metadata
CHANGED
@@ -1,70 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tindy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
7
|
+
- Daniel Gilchrist
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.17'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.17'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
description: A simple Ruby client for Tinder
|
11
|
+
date: 2020-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
42
14
|
email:
|
43
|
-
- danniieelg@gmail.com
|
44
15
|
executables: []
|
45
16
|
extensions: []
|
46
17
|
extra_rdoc_files: []
|
47
18
|
files:
|
48
|
-
- ".gitignore"
|
49
|
-
- ".rubocop.yml"
|
50
|
-
- Gemfile
|
51
|
-
- Gemfile.lock
|
52
|
-
- LICENSE
|
53
|
-
- README.md
|
54
|
-
- Rakefile
|
55
|
-
- bin/console
|
56
|
-
- bin/setup
|
57
19
|
- lib/tindy.rb
|
58
20
|
- lib/tindy/client.rb
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
metadata:
|
63
|
-
|
64
|
-
homepage_uri: https://github.com/DanielGilchrist/tindy
|
65
|
-
source_code_uri: https://github.com/DanielGilchrist/tindy
|
66
|
-
changelog_uri: https://github.com/DanielGilchrist/tindy
|
67
|
-
post_install_message:
|
21
|
+
homepage:
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
68
26
|
rdoc_options: []
|
69
27
|
require_paths:
|
70
28
|
- lib
|
@@ -79,9 +37,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
37
|
- !ruby/object:Gem::Version
|
80
38
|
version: '0'
|
81
39
|
requirements: []
|
82
|
-
|
83
|
-
|
84
|
-
signing_key:
|
40
|
+
rubygems_version: 3.0.8
|
41
|
+
signing_key:
|
85
42
|
specification_version: 4
|
86
43
|
summary: A simple Ruby client for Tinder
|
87
44
|
test_files: []
|
data/.gitignore
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
|
2
|
-
# Created by https://www.gitignore.io/api/ruby
|
3
|
-
# Edit at https://www.gitignore.io/?templates=ruby
|
4
|
-
|
5
|
-
### Ruby ###
|
6
|
-
*.gem
|
7
|
-
*.rbc
|
8
|
-
/.config
|
9
|
-
/coverage/
|
10
|
-
/InstalledFiles
|
11
|
-
/pkg/
|
12
|
-
/spec/reports/
|
13
|
-
/spec/examples.txt
|
14
|
-
/test/tmp/
|
15
|
-
/test/version_tmp/
|
16
|
-
/tmp/
|
17
|
-
|
18
|
-
# Used by dotenv library to load environment variables.
|
19
|
-
# .env
|
20
|
-
|
21
|
-
## Specific to RubyMotion:
|
22
|
-
.dat*
|
23
|
-
.repl_history
|
24
|
-
build/
|
25
|
-
*.bridgesupport
|
26
|
-
build-iPhoneOS/
|
27
|
-
build-iPhoneSimulator/
|
28
|
-
|
29
|
-
## Specific to RubyMotion (use of CocoaPods):
|
30
|
-
#
|
31
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
32
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
33
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
34
|
-
#
|
35
|
-
# vendor/Pods/
|
36
|
-
|
37
|
-
## Documentation cache and generated files:
|
38
|
-
/.yardoc/
|
39
|
-
/_yardoc/
|
40
|
-
/doc/
|
41
|
-
/rdoc/
|
42
|
-
|
43
|
-
## Environment normalization:
|
44
|
-
/.bundle/
|
45
|
-
/vendor/bundle
|
46
|
-
/lib/bundler/man/
|
47
|
-
|
48
|
-
# for a library or gem, you might want to ignore these files since the code is
|
49
|
-
# intended to run in multiple environments; otherwise, check them in:
|
50
|
-
# Gemfile.lock
|
51
|
-
# .ruby-version
|
52
|
-
# .ruby-gemset
|
53
|
-
|
54
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
55
|
-
.rvmrc
|
56
|
-
|
57
|
-
# End of https://www.gitignore.io/api/ruby
|
58
|
-
|
59
|
-
# Created by https://www.gitignore.io/api/visualstudiocode
|
60
|
-
# Edit at https://www.gitignore.io/?templates=visualstudiocode
|
61
|
-
|
62
|
-
### VisualStudioCode ###
|
63
|
-
.vscode/*
|
64
|
-
!.vscode/settings.json
|
65
|
-
!.vscode/tasks.json
|
66
|
-
!.vscode/launch.json
|
67
|
-
!.vscode/extensions.json
|
68
|
-
|
69
|
-
### VisualStudioCode Patch ###
|
70
|
-
# Ignore all local history of files
|
71
|
-
.history
|
72
|
-
|
73
|
-
# End of https://www.gitignore.io/api/visualstudiocode
|
data/.rubocop.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'bin/*'
|
4
|
-
|
5
|
-
Metrics/LineLength:
|
6
|
-
Max: 140
|
7
|
-
|
8
|
-
Metrics/MethodLength:
|
9
|
-
Max: 30
|
10
|
-
|
11
|
-
Style/Documentation:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Layout/EmptyLinesAroundAccessModifier:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Style/SymbolArray:
|
18
|
-
Enabled: false
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.5.2)
|
5
|
-
public_suffix (>= 2.0.2, < 4.0)
|
6
|
-
ansi (1.5.0)
|
7
|
-
crack (0.4.3)
|
8
|
-
safe_yaml (~> 1.0.0)
|
9
|
-
hashdiff (0.3.7)
|
10
|
-
httparty (0.16.3)
|
11
|
-
mime-types (~> 3.0)
|
12
|
-
multi_xml (>= 0.5.2)
|
13
|
-
mime-types (3.2.2)
|
14
|
-
mime-types-data (~> 3.2015)
|
15
|
-
mime-types-data (3.2018.0812)
|
16
|
-
minitest (4.7.5)
|
17
|
-
multi_xml (0.6.0)
|
18
|
-
public_suffix (3.0.3)
|
19
|
-
rake (12.3.1)
|
20
|
-
retries (0.0.5)
|
21
|
-
safe_yaml (1.0.4)
|
22
|
-
turn (0.9.7)
|
23
|
-
ansi
|
24
|
-
minitest (~> 4)
|
25
|
-
vcr (4.0.0)
|
26
|
-
webmock (3.4.2)
|
27
|
-
addressable (>= 2.3.6)
|
28
|
-
crack (>= 0.3.2)
|
29
|
-
hashdiff
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
httparty
|
36
|
-
rake
|
37
|
-
retries
|
38
|
-
turn
|
39
|
-
vcr
|
40
|
-
webmock
|
41
|
-
|
42
|
-
BUNDLED WITH
|
43
|
-
1.17.1
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2018 Daniel Gilchrist
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
data/README.md
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
# tindy
|
2
|
-
A shitty ruby client for Tinder (using [this doc](https://gist.github.com/rtt/10403467) as a reference)
|
3
|
-
|
4
|
-
## Installation
|
5
|
-
|
6
|
-
Bundler
|
7
|
-
|
8
|
-
```
|
9
|
-
gem 'tindy'
|
10
|
-
```
|
11
|
-
|
12
|
-
Other
|
13
|
-
|
14
|
-
```
|
15
|
-
[sudo|rvm] gem install tindy
|
16
|
-
```
|
17
|
-
|
18
|
-
## Getting Started
|
19
|
-
Require tindy and initialize the client with your Facebook access token ([instructions](https://gist.github.com/taseppa/66fc7239c66ef285ecb28b400b556938))
|
20
|
-
|
21
|
-
```
|
22
|
-
require 'tindy'
|
23
|
-
|
24
|
-
tindy = Tindy::Client.new("YOUR_FACEBOOK_ACCESS_TOKEN")
|
25
|
-
```
|
26
|
-
|
27
|
-
### Recommendations
|
28
|
-
Returns a list of recommended Tinder users
|
29
|
-
|
30
|
-
```
|
31
|
-
tindy.recommentations
|
32
|
-
```
|
33
|
-
|
34
|
-
### Like/Pass
|
35
|
-
Like or pass a user
|
36
|
-
```
|
37
|
-
# like user
|
38
|
-
tindy.like(12345)
|
39
|
-
|
40
|
-
# pass user
|
41
|
-
tindy.pass(12345)
|
42
|
-
```
|
43
|
-
|
44
|
-
### Updates
|
45
|
-
Get recent updates
|
46
|
-
```
|
47
|
-
tindy.updates
|
48
|
-
```
|
49
|
-
### Report Users
|
50
|
-
Report a user
|
51
|
-
```
|
52
|
-
# report a user for spam
|
53
|
-
tindy.report_user(12345, :spam)
|
54
|
-
|
55
|
-
# report a user for being offensive/inappropriate
|
56
|
-
tindy.report_user(12345, :offensive)
|
57
|
-
tindy.report_user(12345, :inappropriate)
|
58
|
-
```
|
59
|
-
|
60
|
-
### Send Message
|
61
|
-
(I haven't tested if this works)
|
62
|
-
Send a message to one of your matches
|
63
|
-
```
|
64
|
-
tindy.send_message(12345, "Hey how are you?")
|
65
|
-
```
|
66
|
-
|
67
|
-
### Update Location
|
68
|
-
Update your location
|
69
|
-
```
|
70
|
-
tindy.update_location(-27.469770, 153.025131)
|
71
|
-
```
|
72
|
-
|
73
|
-
### Update Profile
|
74
|
-
Update your profile either individually or multiple at once
|
75
|
-
```
|
76
|
-
# update multiple (gender: <0|1>, age_filter_min: <number>, age_filter_max: <number>, update_distance: <number>
|
77
|
-
tindy.update_profile(age_filter_min: 20, age_filter_max: 26)
|
78
|
-
|
79
|
-
# update gender
|
80
|
-
tindy.update_gender(:male)
|
81
|
-
tindy.update_gender(:female)
|
82
|
-
|
83
|
-
# update minumum age
|
84
|
-
tindy.update_min_age(20)
|
85
|
-
|
86
|
-
# update maximum age
|
87
|
-
tindy.update_max_age(26)
|
88
|
-
|
89
|
-
# update distance (km)
|
90
|
-
tindy.update_distance(15)
|
91
|
-
```
|
92
|
-
|
93
|
-
## Future Plans
|
94
|
-
I'm not really taking this gem that seriously but I may add in more functionality, tests (lmao), and whatever else if I find the time.
|
95
|
-
|
96
|
-
## Contributing
|
97
|
-
|
98
|
-
Just schmang up a PR and I'll check it out
|
99
|
-
|
100
|
-
## License
|
101
|
-
|
102
|
-
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
103
|
-
|
104
|
-
## Acknowledgments
|
105
|
-
Couldn't have been build without [this doc](https://gist.github.com/rtt/10403467) and the people commenting on it <3
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "tindy"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/lib/tindy/version.rb
DELETED