tinder_pyro 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 079dd8d677e34288a62cb26f327164fcf71b7f43
4
+ data.tar.gz: b5a6ed55b3436db1ee9bc79e07d711d0e6dada94
5
+ SHA512:
6
+ metadata.gz: 5843ab26b55d20f9ead5d655f02e183521dd7854076eb19e354ac7c67440325106c28275aeeea6fde14efb995677c47b1746afe2a933e0e857cf109486bf04c2
7
+ data.tar.gz: 562b8076f705977288e5e3a13e5c2b660f2914109a7891cff1b733f7c750e210f59677456c49858a56fe6529b8f964aa5951c7abdc9fc2b2d304ddbab83c8be7
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ *.rbc
3
+ .DS_Store
4
+ .bundle
5
+ .config
6
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Dependencies in gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Neal Kemp
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,112 @@
1
+ Tinder Pyro
2
+ ===========
3
+
4
+ A wrapper for the Tinder App API.
5
+
6
+
7
+ Installation
8
+ ------------
9
+
10
+ Add this line to your application's `Gemfile`:
11
+
12
+ gem 'tinder_pyro', '~> 0.0.1'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Alternatively, install it via command line:
19
+
20
+ $ gem install tinder_pyro
21
+
22
+
23
+ Getting Your oauth Token
24
+ ------------------------
25
+
26
+ Before using pyro, you must grab your Facebook oauth token. This is best done by
27
+ installing (Charles)[http://www.charlesproxy.com/]. This will allow you to view
28
+ all HTTP requests from your phone to the network. Note that Tinder uses SSL so
29
+ you must set up SSL proxying.
30
+
31
+ After setting up your proxy, all you need to do in log out and then back in to
32
+ the Tinder app. Make sure you are recording with Charles, and it will give you a
33
+ request to `https://api.gotinder.com/auth` that looks like:
34
+
35
+ {
36
+ "facebook_token":"CAAGm0PX4ZCp...",
37
+ "facebook_id": "547255555"
38
+ }
39
+
40
+ Now use your Facebook ID and token as shown below.
41
+
42
+
43
+ Usage
44
+ -----
45
+
46
+ **Authenticating**
47
+
48
+ ```ruby
49
+ FACEBOOK_ID = '547255555'
50
+ FACEBOOK_TOKEN = 'CAAGm0PX4ZCp...'
51
+
52
+ pyro = TinderPyro::Client.new
53
+ pyro.sign_in(FACEBOOK_ID, FACEBOOK_TOKEN)
54
+ ```
55
+
56
+ **Interacting with users**
57
+
58
+ ```ruby
59
+ # Get nearby users
60
+ pyro.get_nearby_users
61
+
62
+ user_id = '51ddbe849573ef0d12011111'
63
+
64
+ # Get a user's info
65
+ pyro.info_for_user(user_id)
66
+
67
+ # Swipe Right
68
+ pyro.like(user_id)
69
+
70
+ # Swipe Left
71
+ pyro.dislike(user_id)
72
+
73
+ # Send a saucy message
74
+ pyro.send_message(user_id, 'I luv u plz b my friend')
75
+ ```
76
+
77
+ **Interacting with yourself**
78
+
79
+ ```ruby
80
+ # Update your location
81
+ # Note: this request often takes around 30 seconds
82
+ latitude = 16.7758
83
+ longitude = 3.0094
84
+
85
+ pyro.update_location(latitude, longitude)
86
+
87
+ # Fetch updates (messages, likes, etc)
88
+ pyro.fetch_updates
89
+ ```
90
+
91
+
92
+ Contributing
93
+ ------------
94
+
95
+ 1. Fork it
96
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
97
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
98
+ 4. Push to the branch (`git push origin my-new-feature`)
99
+ 5. Add tests and make sure they pass
100
+ 6. Create new Pull Request
101
+
102
+
103
+ Credits
104
+ -------
105
+
106
+ * [Neal Kemp](http://nealke.mp)
107
+ * [Carolyn Atterbury](http://github.com/carocaro1234) for coming up with the
108
+ name
109
+
110
+ Copyright © 2014 Neal Kemp
111
+
112
+ Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,6 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ require 'pyro/client'
5
+ require 'pyro/requestor'
6
+ require 'pyro/utilities'
@@ -0,0 +1,49 @@
1
+ module TinderPyro
2
+ class Client
3
+ def initialize
4
+ @requestor = Requestor.new
5
+ end
6
+
7
+ def dislike(user_id)
8
+ @requestor.get_request("pass/#{user_id}")
9
+ end
10
+
11
+ def fetch_updates(last_activity_time = Time.now)
12
+ @requestor.post_request(
13
+ :updates,
14
+ last_activity_date: Utilities.format_time(last_activity_time)
15
+ )
16
+ end
17
+
18
+ def get_nearby_users
19
+ @requestor.get_request('user/recs')
20
+ end
21
+
22
+ def info_for_user(user_id)
23
+ @requestor.get_request("user/#{user_id}")
24
+ end
25
+
26
+ def like(user_id)
27
+ @requestor.get_request("like/#{user_id}")
28
+ end
29
+
30
+ def profile
31
+ @requestor.get_request(:profile)
32
+ end
33
+
34
+ def send_message(user_id, message)
35
+ @requestor.post_request(
36
+ "user/matches/#{user_id}",
37
+ message: message
38
+ )
39
+ end
40
+
41
+ def sign_in(facebook_id, facebook_token)
42
+ @requestor.auth_request(facebook_id, facebook_token)
43
+ end
44
+
45
+ def update_location(latitude, longitude)
46
+ @requestor.post_request("user/ping", lat: latitude, lon: longitude)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,53 @@
1
+ module TinderPyro
2
+ class Requestor
3
+ include HTTParty
4
+
5
+ base_uri 'https://api.gotinder.com'
6
+
7
+ def auth_request(facebook_id, facebook_token)
8
+ post_request(
9
+ :auth,
10
+ facebook_id: facebook_id,
11
+ facebook_token: facebook_token
12
+ ).tap do |response|
13
+ @auth_token = response['token']
14
+ end
15
+ end
16
+
17
+ def get_request(endpoint)
18
+ self.class.get("/#{endpoint}", headers: all_headers)
19
+ end
20
+
21
+ def post_request(endpoint, data = {})
22
+ self.class.post(
23
+ "/#{endpoint}",
24
+ body: data.to_json,
25
+ headers: all_headers
26
+ )
27
+ end
28
+
29
+ private
30
+
31
+ def all_headers
32
+ default_headers.merge(auth_headers)
33
+ end
34
+
35
+ def auth_headers
36
+ if @auth_token
37
+ {
38
+ 'Authentication' => %Q(Token token="#{@auth_token}"),
39
+ 'X-Auth-Token' => @auth_token
40
+ }
41
+ else
42
+ {}
43
+ end
44
+ end
45
+
46
+ def default_headers
47
+ {
48
+ 'Content-Type' => 'application/json; charset=utf-8',
49
+ 'User-Agent' => 'Tinder/3.0.2 (iPhone; iOS 7.0.4; Scale/2.00)'
50
+ }
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,9 @@
1
+ module TinderPyro
2
+ module Utilities
3
+ extend self
4
+
5
+ def format_time(time)
6
+ time.utc.iso8601(3)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe TinderPyro::Utilities do
4
+ describe '.format_time' do
5
+ it 'converts time to iso8601 with milliseconds' do
6
+ time = Time.new(2014, 2, 17, 18, 25, 42, '-08:00')
7
+
8
+ formatted_time = TinderPyro::Utilities.format_time(time)
9
+
10
+ expect(formatted_time).to eq '2014-02-18T02:25:42.000Z'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ require 'pyro'
2
+ require 'webmock/rspec'
3
+
4
+ RSpec.configure do |config|
5
+ config.treat_symbols_as_metadata_keys_with_true_values = true
6
+ config.run_all_when_everything_filtered = true
7
+ config.filter_run :focus
8
+ config.order = 'random'
9
+ end
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'tinder_pyro'
7
+ spec.version = '0.0.1'
8
+ spec.authors = ['Neal Kemp']
9
+ spec.email = ['']
10
+ spec.description = %q{Tinder dating app API wrapper.}
11
+ spec.summary = %q{Ruby wrapper for Tinder's private API.}
12
+ spec.homepage = 'https://github.com/nneal/pyro'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = '>= 1.9.3'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'httparty', '~> 0.3'
22
+ spec.add_runtime_dependency 'json', '~> 1.6'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake', '~> 10'
26
+ spec.add_development_dependency 'webmock', '~> 1.10'
27
+ spec.add_development_dependency 'rspec', '~> 2.14'
28
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tinder_pyro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Neal Kemp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.14'
97
+ description: Tinder dating app API wrapper.
98
+ email:
99
+ - ''
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - lib/pyro.rb
111
+ - lib/pyro/client.rb
112
+ - lib/pyro/requestor.rb
113
+ - lib/pyro/utilities.rb
114
+ - spec/pyro/utilities_spec.rb
115
+ - spec/spec_helper.rb
116
+ - tinder_pyro.gemspec
117
+ homepage: https://github.com/nneal/pyro
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 1.9.3
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.2.2
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Ruby wrapper for Tinder's private API.
141
+ test_files:
142
+ - spec/pyro/utilities_spec.rb
143
+ - spec/spec_helper.rb