tinder_client 0.1.0
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 +7 -0
- data/.circleci/config.yml +43 -0
- data/.gitignore +68 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/tasks/tinder.rake +81 -0
- data/lib/tinder/account_settings.rb +175 -0
- data/lib/tinder/client.rb +75 -0
- data/lib/tinder/get_recommended_users.rb +79 -0
- data/lib/tinder/get_updates.rb +85 -0
- data/lib/tinder/like.rb +17 -0
- data/lib/tinder/pass.rb +17 -0
- data/lib/tinder/profile.rb +109 -0
- data/lib/tinder/version.rb +3 -0
- data/lib/tinder.rb +34 -0
- data/tinder_client.gemspec +38 -0
- metadata +195 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4a8b1c5a7afb9f62a324537e4ad909dfe8906709bed2d82b0beadabae23dc2f8
|
|
4
|
+
data.tar.gz: fa8a7f7c7601297a802a56e71bea546cc5f5ce4984fcca8edba1d0c2a50c62b8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 22a407571b89d7bb1748f9ea54a55f4015a1a9bc5250302e044f8386336530699fe856d8dfd1949f14658426619a78f1f68b075b706dc3715b68a0ae8e2d5b3c
|
|
7
|
+
data.tar.gz: b5721e1af5cc95d266ec179b0143baa6ad11f6458e74635be2d450bf235f6c19815a8f80481907a9794335a3897fbefebdd6be0dd9507aa79600a458d8f21213
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
jobs:
|
|
3
|
+
build:
|
|
4
|
+
parallelism: 1
|
|
5
|
+
docker:
|
|
6
|
+
- image: circleci/ruby:2.6.3
|
|
7
|
+
environment:
|
|
8
|
+
BUNDLE_JOBS: 2
|
|
9
|
+
BUNDLE_RETRY: 3
|
|
10
|
+
BUNDLE_PATH: ~/.cache/bundler
|
|
11
|
+
steps:
|
|
12
|
+
- checkout
|
|
13
|
+
- run:
|
|
14
|
+
name: bundle lock
|
|
15
|
+
command: mkdir -p ~/.cache; bundle lock --update
|
|
16
|
+
- restore_cache:
|
|
17
|
+
key: bundle-{{ checksum "Gemfile.lock" }}
|
|
18
|
+
- run:
|
|
19
|
+
name: bundle install
|
|
20
|
+
command: bundle check &>/dev/null || bundle install
|
|
21
|
+
- save_cache:
|
|
22
|
+
key: bundle-{{ checksum "Gemfile.lock" }}
|
|
23
|
+
paths:
|
|
24
|
+
- ~/.cache/bundler
|
|
25
|
+
- run:
|
|
26
|
+
name: rspec
|
|
27
|
+
path: .
|
|
28
|
+
command: |
|
|
29
|
+
mkdir -p ~/rspec
|
|
30
|
+
bundle exec rspec --profile 10 \
|
|
31
|
+
--out ~/rspec/rspec.xml \
|
|
32
|
+
--format progress \
|
|
33
|
+
$( circleci tests glob "spec/**/*_spec.rb" | \
|
|
34
|
+
circleci tests split --split-by=timings )
|
|
35
|
+
- store_test_results:
|
|
36
|
+
path: ~/rspec
|
|
37
|
+
- store_artifacts:
|
|
38
|
+
path: ~/rspec
|
|
39
|
+
workflows:
|
|
40
|
+
version: 2
|
|
41
|
+
workflow:
|
|
42
|
+
jobs:
|
|
43
|
+
- build
|
data/.gitignore
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/.bundle/
|
|
2
|
+
/.yardoc
|
|
3
|
+
/_yardoc/
|
|
4
|
+
/coverage/
|
|
5
|
+
/doc/
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/tmp/
|
|
9
|
+
|
|
10
|
+
# rspec failure tracking
|
|
11
|
+
.rspec_status
|
|
12
|
+
### Ruby template
|
|
13
|
+
*.gem
|
|
14
|
+
*.rbc
|
|
15
|
+
/.config
|
|
16
|
+
/coverage/
|
|
17
|
+
/InstalledFiles
|
|
18
|
+
/pkg/
|
|
19
|
+
/spec/reports/
|
|
20
|
+
/spec/examples.txt
|
|
21
|
+
/test/tmp/
|
|
22
|
+
/test/version_tmp/
|
|
23
|
+
/tmp/
|
|
24
|
+
|
|
25
|
+
# Used by dotenv library to load environment variables.
|
|
26
|
+
# .env
|
|
27
|
+
|
|
28
|
+
# Ignore Byebug command history file.
|
|
29
|
+
.byebug_history
|
|
30
|
+
|
|
31
|
+
## Specific to RubyMotion:
|
|
32
|
+
.dat*
|
|
33
|
+
.repl_history
|
|
34
|
+
build/
|
|
35
|
+
*.bridgesupport
|
|
36
|
+
build-iPhoneOS/
|
|
37
|
+
build-iPhoneSimulator/
|
|
38
|
+
|
|
39
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
40
|
+
#
|
|
41
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
42
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
43
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
44
|
+
#
|
|
45
|
+
# vendor/Pods/
|
|
46
|
+
|
|
47
|
+
## Documentation cache and generated files:
|
|
48
|
+
/.yardoc/
|
|
49
|
+
/_yardoc/
|
|
50
|
+
/doc/
|
|
51
|
+
/rdoc/
|
|
52
|
+
|
|
53
|
+
## Environment normalization:
|
|
54
|
+
/.bundle/
|
|
55
|
+
/vendor/bundle
|
|
56
|
+
/lib/bundler/man/
|
|
57
|
+
|
|
58
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
59
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
60
|
+
Gemfile.lock
|
|
61
|
+
.ruby-version
|
|
62
|
+
.ruby-gemset
|
|
63
|
+
|
|
64
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
65
|
+
.rvmrc
|
|
66
|
+
|
|
67
|
+
# RubyMine IDE
|
|
68
|
+
/.idea/
|
data/.rspec
ADDED
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tinder_client
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-2.6.4
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at patrick.clery@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
gem 'bundler', '~> 2.0'
|
|
4
|
+
gem 'faraday', '~> 0.15.0'
|
|
5
|
+
gem 'hashdiff', ['>= 1.0.0.beta1'] # fix for webmock
|
|
6
|
+
gem 'rspec', '~> 3.8'
|
|
7
|
+
gem 'webmock', '3.6.0'
|
|
8
|
+
gem 'awesome_print',
|
|
9
|
+
git: 'https://github.com/awesome-print/awesome_print.git',
|
|
10
|
+
ref: '4564fd7'
|
|
11
|
+
|
|
12
|
+
gem 'dry-initializer', git: 'https://github.com/dry-rb/dry-initializer.git', ref: '3167b5a'
|
|
13
|
+
gem 'dry-struct', git: 'https://github.com/dry-rb/dry-struct.git', ref: 'ef8c259'
|
|
14
|
+
gem 'dry-types', git: 'https://github.com/dry-rb/dry-types.git', ref: 'da1367f'
|
|
15
|
+
|
|
16
|
+
# Specify your gem's dependencies in tinder.gemspec
|
|
17
|
+
gemspec
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Patrick Clery
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
RSpec Tests: [](https://circleci.com/gh/patrickclery/tinder_client)
|
|
2
|
+
|
|
3
|
+
# TinderClient
|
|
4
|
+
|
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tinder_client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
6
|
+
|
|
7
|
+
TODO: Delete this and the text above, and describe your gem
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'tinder_client'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install tinder_client
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
rake tinder:get_updates # Fetch updates
|
|
29
|
+
rake tinder:profile # Fetch my profile
|
|
30
|
+
rake tinder:recommendations # Fetch recommendations
|
|
31
|
+
rake tinder:save_token # Save an API token to $token_path ake tinder:get_updates # Fetch updates
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
37
|
+
|
|
38
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
39
|
+
|
|
40
|
+
## Contributing
|
|
41
|
+
|
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tinder_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
47
|
+
|
|
48
|
+
## Code of Conduct
|
|
49
|
+
|
|
50
|
+
Everyone interacting in the TinderClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tinder_client/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "tinder"
|
|
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
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'rake'
|
|
5
|
+
require "tinder"
|
|
6
|
+
|
|
7
|
+
# ### Environment Variables
|
|
8
|
+
# `phone_number` - the phone number to login with
|
|
9
|
+
# `tinder_token_path` - where to store access_token.txt
|
|
10
|
+
|
|
11
|
+
def fetch_token(phone_number)
|
|
12
|
+
client = Tinder::Client
|
|
13
|
+
|
|
14
|
+
# Request a code
|
|
15
|
+
client.request_code(phone_number)
|
|
16
|
+
puts ("Enter the confirmation code sent to #{phone_number}> ")
|
|
17
|
+
confirmation_code = STDIN.gets.chomp.to_s
|
|
18
|
+
|
|
19
|
+
# Validate the code and get our 2nd auth factor (refresh token)
|
|
20
|
+
puts "Validating..."
|
|
21
|
+
refresh_token = client.validate(phone_number, confirmation_code)
|
|
22
|
+
puts "Done!\n"
|
|
23
|
+
puts "Your refresh token is #{refresh_token}\n"
|
|
24
|
+
|
|
25
|
+
# Login using the 2nd key
|
|
26
|
+
puts "Logging in..."
|
|
27
|
+
api_token = client.login(phone_number, refresh_token)
|
|
28
|
+
puts "Done!\n"
|
|
29
|
+
puts "Your tinder API token is #{api_token}\n"
|
|
30
|
+
api_token
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def token_path
|
|
34
|
+
"#{ENV['tinder_token_path'] || '.'}/tinder_access_token.txt"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
namespace :tinder do
|
|
38
|
+
|
|
39
|
+
desc 'Fetch an API token from Tinder'
|
|
40
|
+
task :fetch_token do
|
|
41
|
+
fetch_token(ENV['phone_number'].to_s)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
desc 'Save an API token to $token_path'
|
|
45
|
+
task :save_token do
|
|
46
|
+
access_token = fetch_token(ENV['phone_number'].to_s)
|
|
47
|
+
File.open(token_path, 'w') { |f| f.puts(access_token) }
|
|
48
|
+
puts "Saved to #{token_path}\n"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
desc 'Fetch my profile'
|
|
52
|
+
task :profile do
|
|
53
|
+
client = Tinder::Client
|
|
54
|
+
client.api_token = IO.read(token_path).chomp
|
|
55
|
+
profile = client.profile
|
|
56
|
+
puts profile
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
desc 'Fetch recommendations'
|
|
60
|
+
task :recommendations do
|
|
61
|
+
client = Tinder::Client
|
|
62
|
+
client.api_token = IO.read(token_path).chomp
|
|
63
|
+
|
|
64
|
+
feed = client.get_recommended_users(:recommendations)
|
|
65
|
+
feed.each do |person|
|
|
66
|
+
puts person
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
desc 'Fetch updates'
|
|
71
|
+
task :get_updates do
|
|
72
|
+
client = Tinder::Client
|
|
73
|
+
client.api_token = IO.read(token_path).chomp
|
|
74
|
+
|
|
75
|
+
updates = client.get_updates
|
|
76
|
+
updates.matches.each do |match|
|
|
77
|
+
puts match
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
attr_accessor :active_user
|
|
4
|
+
|
|
5
|
+
class Client
|
|
6
|
+
|
|
7
|
+
# @return AccountSettings
|
|
8
|
+
def account_settings
|
|
9
|
+
response = get("https://api.gotinder.com/v2/meta")
|
|
10
|
+
|
|
11
|
+
fail('Unexpected response') if response.dig('data').nil?
|
|
12
|
+
|
|
13
|
+
AccountSettings.new(response['data'])
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class AccountSettings < Dry::Struct
|
|
18
|
+
attribute :client_resources do
|
|
19
|
+
attribute :rate_card do
|
|
20
|
+
attribute :carousel, Dry::Types['array'].of(Dry::Types['hash'])
|
|
21
|
+
end
|
|
22
|
+
attribute :plus_screen, Dry::Types['array']
|
|
23
|
+
end
|
|
24
|
+
attribute :account do
|
|
25
|
+
attribute :fireboarding, Dry::Types['bool']
|
|
26
|
+
attribute :email_prompt_show_strict_opt_in, Dry::Types['bool']
|
|
27
|
+
attribute :email_prompt_show_marketing_opt_in, Dry::Types['bool']
|
|
28
|
+
attribute :email_prompt_required, Dry::Types['bool']
|
|
29
|
+
attribute :email_prompt_dismissible, Dry::Types['bool']
|
|
30
|
+
end
|
|
31
|
+
attribute :boost do
|
|
32
|
+
attribute :enabled, Dry::Types['bool']
|
|
33
|
+
attribute :duration, Dry::Types['integer']
|
|
34
|
+
attribute :intro_multiplier, Dry::Types['integer']
|
|
35
|
+
attribute :use_new_copy, Dry::Types['bool']
|
|
36
|
+
end
|
|
37
|
+
attribute :super_boost do
|
|
38
|
+
attribute :enabled, Dry::Types['bool']
|
|
39
|
+
attribute :duration, Dry::Types['integer']
|
|
40
|
+
attribute :intro_multiplier, Dry::Types['integer']
|
|
41
|
+
attribute :peak_hours_start_h, Dry::Types['integer']
|
|
42
|
+
attribute :peak_hours_start_m, Dry::Types['integer']
|
|
43
|
+
attribute :peak_hours_duration, Dry::Types['integer']
|
|
44
|
+
attribute :variant, Dry::Types['integer']
|
|
45
|
+
attribute :members_only_text, Dry::Types['string']
|
|
46
|
+
attribute :p1, Dry::Types['bool']
|
|
47
|
+
attribute :entry_gold_home, Dry::Types['bool']
|
|
48
|
+
attribute :entry_upgrade, Dry::Types['bool']
|
|
49
|
+
end
|
|
50
|
+
attribute :sexual_orientations do
|
|
51
|
+
attribute :enabled, Dry::Types['bool']
|
|
52
|
+
attribute :orientations, Dry::Types['array'].of(Dry::Types['hash'])
|
|
53
|
+
attribute :excluded_orientations, Dry::Types['array'].of(Dry::Types['string'])
|
|
54
|
+
end
|
|
55
|
+
attribute :credit_card do
|
|
56
|
+
attribute :variant, Dry::Types['integer']
|
|
57
|
+
attribute :price_tos_on_top, Dry::Types['bool']
|
|
58
|
+
end
|
|
59
|
+
attribute :readreceipts do
|
|
60
|
+
attribute :enabled, Dry::Types['bool']
|
|
61
|
+
end
|
|
62
|
+
attribute :fast_match do
|
|
63
|
+
attribute :enabled, Dry::Types['bool']
|
|
64
|
+
attribute :preview_minimum_time, Dry::Types['integer']
|
|
65
|
+
attribute :notif_options, Dry::Types['array'].of(Dry::Types['integer'])
|
|
66
|
+
attribute :notif_defaults, Dry::Types['integer']
|
|
67
|
+
attribute :new_count_fetch_interval, Dry::Types['integer']
|
|
68
|
+
attribute :boost_new_count_fetch_interval, Dry::Types['integer']
|
|
69
|
+
attribute :new_count_threshold, Dry::Types['integer']
|
|
70
|
+
attribute :polling_mode, Dry::Types['integer']
|
|
71
|
+
attribute :entry_point, Dry::Types['bool']
|
|
72
|
+
attribute :controlla_optimization, Dry::Types['bool']
|
|
73
|
+
attribute :use_teaser_endpoint, Dry::Types['bool']
|
|
74
|
+
end
|
|
75
|
+
attribute :gold_homepage do
|
|
76
|
+
attribute :enabled, Dry::Types['bool']
|
|
77
|
+
end
|
|
78
|
+
attribute :top_picks do
|
|
79
|
+
attribute :enabled, Dry::Types['bool']
|
|
80
|
+
attribute :local_daily_enabled, Dry::Types['bool']
|
|
81
|
+
attribute :local_daily_msg, Dry::Types['string']
|
|
82
|
+
attribute :local_daily_offsets do
|
|
83
|
+
attribute :offset0, Dry::Types['integer']
|
|
84
|
+
attribute :offset1, Dry::Types['integer']
|
|
85
|
+
attribute :offset2, Dry::Types['integer']
|
|
86
|
+
attribute :offset3, Dry::Types['integer']
|
|
87
|
+
end
|
|
88
|
+
attribute :free_daily, Dry::Types['bool']
|
|
89
|
+
attribute :num_free_rated_limit, Dry::Types['integer']
|
|
90
|
+
attribute :refresh_interval, Dry::Types['integer']
|
|
91
|
+
attribute :lookahead, Dry::Types['integer']
|
|
92
|
+
attribute :post_swipe_paywall, Dry::Types['bool']
|
|
93
|
+
end
|
|
94
|
+
attribute :intro_pricing do
|
|
95
|
+
attribute :enabled, Dry::Types['bool']
|
|
96
|
+
end
|
|
97
|
+
attribute :paywall do
|
|
98
|
+
attribute :full_price, Dry::Types['bool']
|
|
99
|
+
attribute :e1, Dry::Types['bool']
|
|
100
|
+
attribute :e2, Dry::Types['bool']
|
|
101
|
+
attribute :bouncer_avatar, Dry::Types['bool']
|
|
102
|
+
attribute :pbls, Dry::Types['bool']
|
|
103
|
+
attribute :show_likes_count_in_bouncer, Dry::Types['bool']
|
|
104
|
+
attribute :e3, Dry::Types['integer']
|
|
105
|
+
attribute :e4, Dry::Types['integer']
|
|
106
|
+
end
|
|
107
|
+
attribute :merchandising do
|
|
108
|
+
attribute :gold_v1_enabled, Dry::Types['bool']
|
|
109
|
+
attribute :gold_v2_enabled, Dry::Types['bool']
|
|
110
|
+
attribute :gamepad_counter_variant, Dry::Types['string']
|
|
111
|
+
end
|
|
112
|
+
attribute :purchase do
|
|
113
|
+
attribute :new_google_purchase, Dry::Types['bool']
|
|
114
|
+
attribute :new_cc_purchase, Dry::Types['bool']
|
|
115
|
+
end
|
|
116
|
+
attribute :recs do
|
|
117
|
+
attribute :card_replay, Dry::Types['bool']
|
|
118
|
+
end
|
|
119
|
+
attribute :tinder_plus do
|
|
120
|
+
attribute :enabled, Dry::Types['bool']
|
|
121
|
+
attribute :discount, Dry::Types['bool']
|
|
122
|
+
end
|
|
123
|
+
attribute :subscription do
|
|
124
|
+
attribute :renewal_banner_title, Dry::Types['string']
|
|
125
|
+
attribute :renewal_banner_gold_body, Dry::Types['string']
|
|
126
|
+
attribute :renewal_banner_plus_body, Dry::Types['string']
|
|
127
|
+
end
|
|
128
|
+
attribute :super_like do
|
|
129
|
+
attribute :enabled, Dry::Types['bool']
|
|
130
|
+
attribute :alc_mode, Dry::Types['integer']
|
|
131
|
+
end
|
|
132
|
+
attribute :profile do
|
|
133
|
+
attribute :can_edit_jobs, Dry::Types['bool']
|
|
134
|
+
attribute :can_edit_schools, Dry::Types['bool']
|
|
135
|
+
attribute :can_edit_email, Dry::Types['bool']
|
|
136
|
+
attribute :can_add_photos_from_facebook, Dry::Types['bool']
|
|
137
|
+
attribute :can_show_common_connections, Dry::Types['bool']
|
|
138
|
+
attribute :school_name_max_length, Dry::Types['integer']
|
|
139
|
+
attribute :job_title_max_length, Dry::Types['integer']
|
|
140
|
+
attribute :company_name_max_length, Dry::Types['integer']
|
|
141
|
+
end
|
|
142
|
+
attribute :select do
|
|
143
|
+
attribute :enabled, Dry::Types['bool']
|
|
144
|
+
attribute :recs_enabled, Dry::Types['bool']
|
|
145
|
+
attribute :invited, Dry::Types['bool']
|
|
146
|
+
end
|
|
147
|
+
attribute :feedback do
|
|
148
|
+
attribute :rate_app, Dry::Types['bool']
|
|
149
|
+
end
|
|
150
|
+
attribute :typing_indicator do
|
|
151
|
+
attribute :typing_heartbeat, Dry::Types['integer']
|
|
152
|
+
attribute :typing_ttl, Dry::Types['integer']
|
|
153
|
+
end
|
|
154
|
+
attribute :places do
|
|
155
|
+
attribute :available, Dry::Types['bool']
|
|
156
|
+
attribute :places_ui, Dry::Types['string']
|
|
157
|
+
end
|
|
158
|
+
attribute :terms_of_service do
|
|
159
|
+
attribute :enabled, Dry::Types['bool']
|
|
160
|
+
end
|
|
161
|
+
attribute :swipe_surge do
|
|
162
|
+
attribute :enabled, Dry::Types['bool']
|
|
163
|
+
attribute :in_swipe_surge, Dry::Types['bool']
|
|
164
|
+
end
|
|
165
|
+
attribute :traveling, Dry::Types['hash']
|
|
166
|
+
attribute :crm_inbox do
|
|
167
|
+
attribute :enabled, Dry::Types['bool']
|
|
168
|
+
end
|
|
169
|
+
attribute :background_location do
|
|
170
|
+
attribute :enabled, Dry::Types['bool']
|
|
171
|
+
end
|
|
172
|
+
attribute :levers, Dry::Types['hash']
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
class Client
|
|
4
|
+
# Always prefer V2 endpoints as the API is less buggy than V1
|
|
5
|
+
BASE_URI = 'https://api.gotinder.com/v2'
|
|
6
|
+
ENDPOINTS = {
|
|
7
|
+
request_code: "/auth/sms/send?auth_type=sms",
|
|
8
|
+
login: "/auth/login/sms",
|
|
9
|
+
validate: "/auth/sms/validate?auth_type=sms"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
attr_accessor :api_token
|
|
13
|
+
attr_accessor :refresh_token
|
|
14
|
+
|
|
15
|
+
def post(url, **data)
|
|
16
|
+
response = Faraday.post(url, JSON.generate(data), headers(@api_token))
|
|
17
|
+
JSON.parse(response.body)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get(url, **data)
|
|
21
|
+
# GET requests won't get a response using JSON
|
|
22
|
+
response = Faraday.get(url, data, headers(@api_token))
|
|
23
|
+
JSON.parse(response.body)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @param phone_number String
|
|
27
|
+
def request_code(phone_number)
|
|
28
|
+
response = post(endpoint(:request_code), phone_number: phone_number)
|
|
29
|
+
response.dig('data', 'sms_sent') || fail(UnexpectedResponse(response))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @param phone_number String Your phone number
|
|
33
|
+
# @param confirmation_code String The code sent to your phone
|
|
34
|
+
# @return String Named 'refresh token', this is one part of the 2-part authentication keys
|
|
35
|
+
def validate(phone_number, confirmation_code)
|
|
36
|
+
data = { otp_code: confirmation_code,
|
|
37
|
+
phone_number: phone_number,
|
|
38
|
+
is_update: false }
|
|
39
|
+
|
|
40
|
+
response = post(endpoint(:validate), data)
|
|
41
|
+
@refresh_token = response.dig('data', 'refresh_token') || fail(UnexpectedResponse(response))
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @param phone_number String Your phone number
|
|
45
|
+
# @param confirmation_code String The code sent to your phone
|
|
46
|
+
# @return String The API key
|
|
47
|
+
def login(phone_number, refresh_token)
|
|
48
|
+
data = { refresh_token: refresh_token, phone_number: phone_number }
|
|
49
|
+
response = post(endpoint(:login), data)
|
|
50
|
+
|
|
51
|
+
@api_token = response.dig('data', 'api_token') || fail(UnexpectedResponse(response))
|
|
52
|
+
@id = response['data']['_id']
|
|
53
|
+
@is_new_user = response['data']['is_new_user']
|
|
54
|
+
@api_token
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def endpoint(action)
|
|
58
|
+
"#{BASE_URI}#{ENDPOINTS[action]}"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
protected
|
|
62
|
+
|
|
63
|
+
def headers(api_token)
|
|
64
|
+
{
|
|
65
|
+
'app_version': '6.9.4',
|
|
66
|
+
'platform': 'ios',
|
|
67
|
+
"content-type": "application/json",
|
|
68
|
+
"User-agent": "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)",
|
|
69
|
+
"Accept": "application/json",
|
|
70
|
+
"X-Auth-Token": api_token
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
class Client
|
|
4
|
+
def get_recommended_users(&block)
|
|
5
|
+
if block_given?
|
|
6
|
+
yield get_recommended_users && return
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
data = get("https://api.gotinder.com/recs/core")
|
|
10
|
+
|
|
11
|
+
fail 'Connection Timeout' unless data.dig('data', 'timeout').nil?
|
|
12
|
+
|
|
13
|
+
error_message = data.dig('error', 'message')
|
|
14
|
+
fail 'Rate Limited' if error_message == 'RATE_LIMITED'
|
|
15
|
+
return [] if error_message == 'There is no one around you'
|
|
16
|
+
fail 'Unknown Error' unless error_message.nil?
|
|
17
|
+
|
|
18
|
+
results = Array(data.dig('data', 'results'))
|
|
19
|
+
return [] if results.first.is_a?(String) && results.first == 'You are out of likes today. Come back later to continue swiping on more people.'
|
|
20
|
+
|
|
21
|
+
JSON.parse(results.first).map { |user_data| RecommendedUser.new(user_data) }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class RecommendedUser < Dry::Struct
|
|
26
|
+
|
|
27
|
+
attribute :type, Dry::Types['string']
|
|
28
|
+
attribute :user do
|
|
29
|
+
attribute :_id, Dry::Types['string']
|
|
30
|
+
attribute :bio, Dry::Types['string']
|
|
31
|
+
attribute :birth_date, Dry::Types['string']
|
|
32
|
+
attribute :name, Dry::Types['string']
|
|
33
|
+
attribute :photos, Dry::Types['array'] do
|
|
34
|
+
attribute :id, Dry::Types['string']
|
|
35
|
+
attribute :crop_info do
|
|
36
|
+
attribute :user do
|
|
37
|
+
attribute :width_pct, Dry::Types['float']
|
|
38
|
+
attribute :x_offset_pct, Dry::Types['float']
|
|
39
|
+
attribute :height_pct, Dry::Types['float']
|
|
40
|
+
attribute :y_offset_pct, Dry::Types['float']
|
|
41
|
+
end
|
|
42
|
+
attribute :algo do
|
|
43
|
+
attribute :width_pct, Dry::Types['float']
|
|
44
|
+
attribute :x_offset_pct, Dry::Types['float']
|
|
45
|
+
attribute :height_pct, Dry::Types['float']
|
|
46
|
+
attribute :y_offset_pct, Dry::Types['float']
|
|
47
|
+
end
|
|
48
|
+
attribute :processed_by_bullseye, Dry::Types['bool']
|
|
49
|
+
attribute :user_customized, Dry::Types['bool']
|
|
50
|
+
attribute :url, Dry::Types['string'].meta(omittable: true)
|
|
51
|
+
attribute :processedFiles, Dry::Types['array'].meta(omittable: true)
|
|
52
|
+
attribute :fileName, Dry::Types['string'].meta(omittable: true)
|
|
53
|
+
attribute :extension, Dry::Types['string'].meta(omittable: true)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
attribute :gender, Dry::Types['integer']
|
|
57
|
+
attribute :jobs, Dry::Types['array']
|
|
58
|
+
attribute :schools, Dry::Types['array'] do
|
|
59
|
+
attribute :name, Dry::Types['string']
|
|
60
|
+
end
|
|
61
|
+
attribute :is_traveling, Dry::Types['bool'].meta(omittable: true)
|
|
62
|
+
attribute :hide_age, Dry::Types['bool'].meta(omittable: true)
|
|
63
|
+
attribute :hide_distance, Dry::Types['bool'].meta(omittable: true)
|
|
64
|
+
end
|
|
65
|
+
attribute :facebook do
|
|
66
|
+
attribute :common_connections, Dry::Types['array']
|
|
67
|
+
attribute :connection_count, Dry::Types['integer']
|
|
68
|
+
attribute :common_interests, Dry::Types['array']
|
|
69
|
+
end
|
|
70
|
+
attribute :spotify, Dry::Types['hash']
|
|
71
|
+
attribute :distance_mi, Dry::Types['integer']
|
|
72
|
+
attribute :content_hash, Dry::Types['string']
|
|
73
|
+
attribute :s_number, Dry::Types['integer']
|
|
74
|
+
attribute :teasers, Dry::Types['array'] do
|
|
75
|
+
attribute :type, Dry::Types['string']
|
|
76
|
+
attribute :string, Dry::Types['string']
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
class Client
|
|
4
|
+
# This includes the matches, as well as the messages, so must be parsed
|
|
5
|
+
def get_updates(since = Time.now)
|
|
6
|
+
response = get("https://api.gotinder.com/updates")
|
|
7
|
+
|
|
8
|
+
fail 'Connection Timeout' unless response.dig('data', 'timeout').nil?
|
|
9
|
+
fail 'Rate Limited' if response.dig('error', 'message') == 'RATE_LIMITED'
|
|
10
|
+
# The next one only occurs without Tinder Plus subscription
|
|
11
|
+
fail 'No Results Left' if response.dig('error', 'message') == 'There is no one around you'
|
|
12
|
+
|
|
13
|
+
updates = Updates.new(response)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Updates < Dry::Struct
|
|
18
|
+
|
|
19
|
+
attribute :blocks, Dry::Types['array'].of(Dry::Types['string'])
|
|
20
|
+
attribute :deleted_lists, Dry::Types['array']
|
|
21
|
+
attribute :goingout, Dry::Types['array']
|
|
22
|
+
attribute :harassing_messages, Dry::Types['array']
|
|
23
|
+
attribute :inbox, Dry::Types['array'] do
|
|
24
|
+
attribute :_id, Dry::Types['string']
|
|
25
|
+
attribute :match_id, Dry::Types['string']
|
|
26
|
+
attribute :sent_date, Dry::Types['string']
|
|
27
|
+
attribute :message, Dry::Types['string']
|
|
28
|
+
attribute :to, Dry::Types['string']
|
|
29
|
+
attribute :from, Dry::Types['string']
|
|
30
|
+
attribute :created_date, Dry::Types['string']
|
|
31
|
+
attribute :timestamp, Dry::Types['coercible.string']
|
|
32
|
+
end
|
|
33
|
+
attribute :poll_interval, Dry::Types['hash']
|
|
34
|
+
attribute :liked_messages, Dry::Types['array'] do
|
|
35
|
+
attribute :message_id, Dry::Types['string']
|
|
36
|
+
attribute :updated_at, Dry::Types['string']
|
|
37
|
+
attribute :liker_id, Dry::Types['string']
|
|
38
|
+
attribute :match_id, Dry::Types['string']
|
|
39
|
+
attribute :is_liked, Dry::Types['bool']
|
|
40
|
+
end
|
|
41
|
+
attribute :lists, Dry::Types['array']
|
|
42
|
+
attribute :matches, Dry::Types['array'] do
|
|
43
|
+
attribute :_id, Dry::Types['string']
|
|
44
|
+
attribute :closed, Dry::Types['bool']
|
|
45
|
+
attribute :common_friend_count, Dry::Types['integer']
|
|
46
|
+
attribute :common_like_count, Dry::Types['integer']
|
|
47
|
+
attribute :created_date, Dry::Types['string']
|
|
48
|
+
attribute :dead, Dry::Types['bool']
|
|
49
|
+
attribute :following, Dry::Types['bool']
|
|
50
|
+
attribute :following_moments, Dry::Types['bool']
|
|
51
|
+
attribute :id, Dry::Types['string']
|
|
52
|
+
attribute :is_boost_match, Dry::Types['bool']
|
|
53
|
+
attribute :is_fast_match, Dry::Types['bool']
|
|
54
|
+
attribute :is_super_like, Dry::Types['bool']
|
|
55
|
+
attribute :last_activity_date, Dry::Types['string']
|
|
56
|
+
attribute :message_count, Dry::Types['integer']
|
|
57
|
+
attribute :messages, Dry::Types['array'] do
|
|
58
|
+
attribute :_id, Dry::Types['string']
|
|
59
|
+
attribute :match_id, Dry::Types['string']
|
|
60
|
+
attribute :sent_date, Dry::Types['string']
|
|
61
|
+
attribute :message, Dry::Types['string']
|
|
62
|
+
attribute :to, Dry::Types['string']
|
|
63
|
+
attribute :from, Dry::Types['string']
|
|
64
|
+
attribute :created_date, Dry::Types['string']
|
|
65
|
+
attribute :timestamp, Dry::Types['coercible.string']
|
|
66
|
+
end
|
|
67
|
+
attribute :muted, Dry::Types['bool']
|
|
68
|
+
attribute :participants, Dry::Types['array']
|
|
69
|
+
attribute :pending, Dry::Types['bool']
|
|
70
|
+
attribute :person do
|
|
71
|
+
attribute :bio, Dry::Types['string'].meta(omittable: true)
|
|
72
|
+
attribute :birth_date, Dry::Types['string']
|
|
73
|
+
attribute :gender, Dry::Types['integer']
|
|
74
|
+
attribute :name, Dry::Types['string']
|
|
75
|
+
attribute :ping_time, Dry::Types['string']
|
|
76
|
+
attribute :photos, Dry::Types['array']
|
|
77
|
+
end
|
|
78
|
+
attribute :readreceipt, Dry::Types['hash']
|
|
79
|
+
attribute :seen, Dry::Types['hash']
|
|
80
|
+
end
|
|
81
|
+
attribute :squads, Dry::Types['array']
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
data/lib/tinder/like.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
class Client
|
|
4
|
+
|
|
5
|
+
# This includes the matches, as well as the messages, so must be parsed
|
|
6
|
+
# @return Boolean true on success
|
|
7
|
+
|
|
8
|
+
def like(person_id)
|
|
9
|
+
response = get("https://api.gotinder.com/user/like/#{person_id}")
|
|
10
|
+
|
|
11
|
+
fail 'Connection Timeout' unless response.dig('data', 'timeout').nil?
|
|
12
|
+
fail 'Rate Limited' if response.dig('error', 'message') == 'RATE_LIMITED'
|
|
13
|
+
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/tinder/pass.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
class Client
|
|
4
|
+
|
|
5
|
+
# This includes the matches, as well as the messages, so must be parsed
|
|
6
|
+
# @return Boolean true on success
|
|
7
|
+
|
|
8
|
+
def pass(person_id)
|
|
9
|
+
response = get("https://api.gotinder.com/user/pass/#{person_id}")
|
|
10
|
+
|
|
11
|
+
fail 'Connection Timeout' unless response.dig('data', 'timeout').nil?
|
|
12
|
+
fail 'Rate Limited' if response.dig('error', 'message') == 'RATE_LIMITED'
|
|
13
|
+
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
module Tinder
|
|
2
|
+
|
|
3
|
+
attr_accessor :active_user
|
|
4
|
+
|
|
5
|
+
class Client
|
|
6
|
+
|
|
7
|
+
# @return ActiveProfile
|
|
8
|
+
def profile
|
|
9
|
+
|
|
10
|
+
data = { include: "account,boost,email_settings,instagram," \
|
|
11
|
+
"likes,notifications,plus_control,products," \
|
|
12
|
+
"purchase,spotify,super_likes,tinder_u,"\
|
|
13
|
+
"travel,tutorials,user" }
|
|
14
|
+
|
|
15
|
+
response = get("https://api.gotinder.com/v2/profile", data)
|
|
16
|
+
|
|
17
|
+
fail('Unexpected response') if response.dig('data').nil?
|
|
18
|
+
|
|
19
|
+
ActiveProfile.new(response['data'])
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class ActiveProfile < Dry::Struct
|
|
24
|
+
|
|
25
|
+
attribute :account do
|
|
26
|
+
attribute :is_email_verified, Dry::Types['bool']
|
|
27
|
+
attribute :account_email, Dry::Types['string']
|
|
28
|
+
attribute :account_phone_number, Dry::Types['string']
|
|
29
|
+
end
|
|
30
|
+
attribute :boost do
|
|
31
|
+
attribute :duration, Dry::Types['integer']
|
|
32
|
+
attribute :allotment, Dry::Types['integer']
|
|
33
|
+
attribute :allotment_used, Dry::Types['integer']
|
|
34
|
+
attribute :allotment_remaining, Dry::Types['integer']
|
|
35
|
+
attribute :internal_remaining, Dry::Types['integer']
|
|
36
|
+
attribute :purchased_remaining, Dry::Types['integer']
|
|
37
|
+
attribute :remaining, Dry::Types['integer']
|
|
38
|
+
attribute :super_boost_purchased_remaining, Dry::Types['integer']
|
|
39
|
+
attribute :super_boost_remaining, Dry::Types['integer']
|
|
40
|
+
attribute :boost_refresh_amount, Dry::Types['integer']
|
|
41
|
+
attribute :boost_refresh_interval, Dry::Types['integer']
|
|
42
|
+
attribute :boost_refresh_interval_unit, Dry::Types['string']
|
|
43
|
+
end
|
|
44
|
+
attribute :email_settings do
|
|
45
|
+
attribute :email, Dry::Types['string']
|
|
46
|
+
attribute :email_settings do
|
|
47
|
+
attribute :promotions, Dry::Types['bool']
|
|
48
|
+
attribute :messages, Dry::Types['bool']
|
|
49
|
+
attribute :new_matches, Dry::Types['bool']
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
attribute :instagram do
|
|
53
|
+
attribute :username, Dry::Types['string']
|
|
54
|
+
attribute :profile_picture, Dry::Types['string']
|
|
55
|
+
attribute :media_count, Dry::Types['integer']
|
|
56
|
+
attribute :last_fetch_time, Dry::Types['string']
|
|
57
|
+
attribute :completed_initial_fetch, Dry::Types['bool']
|
|
58
|
+
attribute :photos, Dry::Types['array']
|
|
59
|
+
attribute :should_reauthenticate, Dry::Types['bool']
|
|
60
|
+
end
|
|
61
|
+
attribute :likes do
|
|
62
|
+
attribute :likes_remaining, Dry::Types['integer']
|
|
63
|
+
end
|
|
64
|
+
attribute :notifications, Dry::Types['array']
|
|
65
|
+
attribute :plus_control do
|
|
66
|
+
attribute :discoverable_party, Dry::Types['string']
|
|
67
|
+
attribute :hide_ads, Dry::Types['bool']
|
|
68
|
+
attribute :hide_age, Dry::Types['bool']
|
|
69
|
+
attribute :hide_distance, Dry::Types['bool']
|
|
70
|
+
attribute :blend, Dry::Types['string']
|
|
71
|
+
end
|
|
72
|
+
attribute :products, Dry::Types['hash']
|
|
73
|
+
attribute :purchase, Dry::Types['hash']
|
|
74
|
+
attribute :spotify, Dry::Types['hash']
|
|
75
|
+
attribute :super_likes do
|
|
76
|
+
attribute :remaining, Dry::Types['integer']
|
|
77
|
+
attribute :alc_remaining, Dry::Types['integer']
|
|
78
|
+
attribute :new_alc_remaining, Dry::Types['integer']
|
|
79
|
+
attribute :allotment, Dry::Types['integer']
|
|
80
|
+
attribute :superlike_refresh_amount, Dry::Types['integer']
|
|
81
|
+
attribute :superlike_refresh_interval, Dry::Types['integer']
|
|
82
|
+
attribute :superlike_refresh_interval_unit, Dry::Types['string']
|
|
83
|
+
attribute :resets_at, Dry::Types['string']
|
|
84
|
+
end
|
|
85
|
+
attribute :tinder_u do
|
|
86
|
+
attribute :status, Dry::Types['string']
|
|
87
|
+
end
|
|
88
|
+
attribute :travel do
|
|
89
|
+
attribute :is_traveling, Dry::Types['bool']
|
|
90
|
+
end
|
|
91
|
+
attribute :tutorials, Dry::Types['array']
|
|
92
|
+
attribute :user do
|
|
93
|
+
attribute :_id, Dry::Types['string']
|
|
94
|
+
attribute :age_filter_max, Dry::Types['integer']
|
|
95
|
+
attribute :age_filter_min, Dry::Types['integer']
|
|
96
|
+
attribute :bio, Dry::Types['string']
|
|
97
|
+
attribute :birth_date, Dry::Types['string']
|
|
98
|
+
attribute :create_date, Dry::Types['string']
|
|
99
|
+
attribute :crm_id, Dry::Types['string']
|
|
100
|
+
attribute :discoverable, Dry::Types['bool']
|
|
101
|
+
attribute :distance_filter, Dry::Types['integer']
|
|
102
|
+
attribute :gender, Dry::Types['integer']
|
|
103
|
+
attribute :gender_filter, Dry::Types['integer']
|
|
104
|
+
attribute :name, Dry::Types['string']
|
|
105
|
+
attribute :photos, Dry::Types['array']
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
end
|
data/lib/tinder.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'dry-struct'
|
|
2
|
+
class Dry::Struct
|
|
3
|
+
transform_keys(&:to_sym)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
require 'dry-types'
|
|
7
|
+
require "json"
|
|
8
|
+
require 'faraday'
|
|
9
|
+
require 'tinder/client'
|
|
10
|
+
require 'tinder/profile'
|
|
11
|
+
require 'tinder/account_settings'
|
|
12
|
+
require 'tinder/get_recommended_users'
|
|
13
|
+
require 'tinder/get_updates'
|
|
14
|
+
require 'tinder/profile'
|
|
15
|
+
require 'tinder/like'
|
|
16
|
+
require 'tinder/pass'
|
|
17
|
+
|
|
18
|
+
module Tinder
|
|
19
|
+
|
|
20
|
+
class UnexpectedResponse < StandardError
|
|
21
|
+
end
|
|
22
|
+
class RateLimited < StandardError;
|
|
23
|
+
end
|
|
24
|
+
class ClientNotAuthenticated < StandardError;
|
|
25
|
+
end
|
|
26
|
+
class ConnectionTimeout < StandardError;
|
|
27
|
+
end
|
|
28
|
+
class NoResultsLeft < StandardError;
|
|
29
|
+
end
|
|
30
|
+
class OutOfLikes < StandardError;
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require "tinder/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "tinder_client"
|
|
7
|
+
spec.version = Tinder::VERSION
|
|
8
|
+
spec.authors = ["Patrick Clery"]
|
|
9
|
+
spec.email = ["patrick.clery@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "This client allow you to login and use your Tinder account"
|
|
12
|
+
spec.description = %q{A client for Tinder written in Ruby}
|
|
13
|
+
spec.homepage = "https://github.com/patrickclery/tinder_client"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
18
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
19
|
+
|
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
24
|
+
end
|
|
25
|
+
spec.bindir = "exe"
|
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
|
+
spec.require_paths = ["lib"]
|
|
28
|
+
|
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
30
|
+
spec.add_development_dependency "dry-initializer", "~> 3.0"
|
|
31
|
+
spec.add_development_dependency "dry-struct", "~> 1.0"
|
|
32
|
+
spec.add_development_dependency "dry-types", "~> 1.0"
|
|
33
|
+
spec.add_development_dependency "faraday", "~> 0.15.0"
|
|
34
|
+
spec.add_development_dependency "hashdiff", ">= 1.0.0.beta1"
|
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.8"
|
|
37
|
+
spec.add_development_dependency "webmock", "~> 3.6.0"
|
|
38
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: tinder_client
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Patrick Clery
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: dry-initializer
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: dry-struct
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: dry-types
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '1.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: faraday
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.15.0
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.15.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: hashdiff
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 1.0.0.beta1
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 1.0.0.beta1
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rake
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '10.0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '10.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '3.8'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '3.8'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: webmock
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: 3.6.0
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: 3.6.0
|
|
139
|
+
description: A client for Tinder written in Ruby
|
|
140
|
+
email:
|
|
141
|
+
- patrick.clery@gmail.com
|
|
142
|
+
executables: []
|
|
143
|
+
extensions: []
|
|
144
|
+
extra_rdoc_files: []
|
|
145
|
+
files:
|
|
146
|
+
- ".circleci/config.yml"
|
|
147
|
+
- ".gitignore"
|
|
148
|
+
- ".rspec"
|
|
149
|
+
- ".ruby-gemset"
|
|
150
|
+
- ".ruby-version"
|
|
151
|
+
- ".travis.yml"
|
|
152
|
+
- CODE_OF_CONDUCT.md
|
|
153
|
+
- Gemfile
|
|
154
|
+
- LICENSE.txt
|
|
155
|
+
- README.md
|
|
156
|
+
- Rakefile
|
|
157
|
+
- bin/console
|
|
158
|
+
- bin/setup
|
|
159
|
+
- lib/tasks/tinder.rake
|
|
160
|
+
- lib/tinder.rb
|
|
161
|
+
- lib/tinder/account_settings.rb
|
|
162
|
+
- lib/tinder/client.rb
|
|
163
|
+
- lib/tinder/get_recommended_users.rb
|
|
164
|
+
- lib/tinder/get_updates.rb
|
|
165
|
+
- lib/tinder/like.rb
|
|
166
|
+
- lib/tinder/pass.rb
|
|
167
|
+
- lib/tinder/profile.rb
|
|
168
|
+
- lib/tinder/version.rb
|
|
169
|
+
- tinder_client.gemspec
|
|
170
|
+
homepage: https://github.com/patrickclery/tinder_client
|
|
171
|
+
licenses:
|
|
172
|
+
- MIT
|
|
173
|
+
metadata:
|
|
174
|
+
homepage_uri: https://github.com/patrickclery/tinder_client
|
|
175
|
+
source_code_uri: https://github.com/patrickclery/tinder_client
|
|
176
|
+
post_install_message:
|
|
177
|
+
rdoc_options: []
|
|
178
|
+
require_paths:
|
|
179
|
+
- lib
|
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
|
+
requirements:
|
|
182
|
+
- - ">="
|
|
183
|
+
- !ruby/object:Gem::Version
|
|
184
|
+
version: '0'
|
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
|
+
requirements:
|
|
187
|
+
- - ">="
|
|
188
|
+
- !ruby/object:Gem::Version
|
|
189
|
+
version: '0'
|
|
190
|
+
requirements: []
|
|
191
|
+
rubygems_version: 3.0.6
|
|
192
|
+
signing_key:
|
|
193
|
+
specification_version: 4
|
|
194
|
+
summary: This client allow you to login and use your Tinder account
|
|
195
|
+
test_files: []
|