tinder-ruby 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da1807f4635a77c3c940fe7ef9f16e1d00e74254
4
+ data.tar.gz: bf05b73c63d775980cd1da78db69fef1461ae54f
5
+ SHA512:
6
+ metadata.gz: 193d5617adec79ac83b9d129e7c0cf74bb89af593508d5de6d7f4042304af0c741e926182bb0c1e4ea07093784f00324027a5f238e0674eec7cc0863d7fbc867
7
+ data.tar.gz: 24aae541159580191ce7e7fd906387bbe881e8562a6a133eff76fbbb279dbe391059c517f5096823c77fedd5a429d06005576be7448a6edd40c0dd93dc9950da
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ /.idea
11
+ /.env
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in tinder-ruby.gemspec
8
+ gemspec
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tinder-ruby (0.1.0)
5
+ dotenv (~> 2.2.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ coderay (1.1.2)
11
+ dotenv (2.2.1)
12
+ method_source (0.9.0)
13
+ pry (0.11.3)
14
+ coderay (~> 1.1.0)
15
+ method_source (~> 0.9.0)
16
+ rake (10.5.0)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ bundler (~> 1.16)
23
+ pry (~> 0.11.3)
24
+ rake (~> 10.0)
25
+ tinder-ruby!
26
+
27
+ BUNDLED WITH
28
+ 1.16.0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 ts-3156
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.
@@ -0,0 +1,39 @@
1
+ # Tinder::Ruby
2
+
3
+ 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/ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'tinder-ruby'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install tinder-ruby
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tinder-ruby.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,8 @@
1
+ require 'tinder'
2
+
3
+ token = ENV['FB_TOKEN']
4
+ lat = '35.687537'
5
+ lon = '139.529551'
6
+
7
+ client = Tinder::Client.new(token)
8
+ client.change_location(lat, lon)
@@ -0,0 +1,8 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+
5
+ require 'dotenv/load'
6
+
7
+ require 'tinder/util'
8
+ require 'tinder/client'
@@ -0,0 +1,24 @@
1
+ module Tinder
2
+ class Client
3
+ attr_reader :token
4
+
5
+ def initialize(fb_token = nil)
6
+ @token = fb_token ? auth(fb_token)['token'] : nil
7
+ end
8
+
9
+ def auth(fb_token)
10
+ res = Util.post('/auth', {facebook_token: fb_token})
11
+ JSON.parse(res.body)
12
+ end
13
+
14
+ def profile
15
+ res = Util.post('/profile', {}, {'X-Auth-Token': token})
16
+ JSON.parse(res.body)
17
+ end
18
+
19
+ def change_location(lat, lon)
20
+ res = Util.post('/user/ping', {lat: lat, lon: lon}, {'X-Auth-Token': token})
21
+ JSON.parse(res.body)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ module Tinder
2
+ class Util
3
+ HEADERS = {
4
+ 'Content-Type': 'application/json',
5
+ 'User-agent': 'Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)'
6
+ }
7
+
8
+ class << self
9
+ def request(method, endpoint, payload, headers)
10
+ uri = URI.parse('https://api.gotinder.com' + endpoint)
11
+ https = Net::HTTP.new(uri.host, uri.port)
12
+
13
+ https.use_ssl = true
14
+ req =
15
+ if method == :post
16
+ Net::HTTP::Post.new(uri.request_uri)
17
+ else
18
+ Net::HTTP::Get.new(uri.request_uri)
19
+ end
20
+
21
+ HEADERS.merge(headers).each {|k, v| req[k] = v}
22
+
23
+ req.body = payload.to_json
24
+
25
+ https.request(req)
26
+ end
27
+
28
+ def post(endpoint, payload, headers = {})
29
+ request(:post, endpoint, payload, headers)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,28 @@
1
+
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-ruby"
7
+ spec.version = "0.1.0"
8
+ spec.authors = ["ts-3156"]
9
+ spec.email = ["ts_3156@yahoo.co.jp"]
10
+
11
+ spec.summary = "A Ruby interface to the Tinder API"
12
+ spec.description = "A Ruby interface to the Tinder API"
13
+ spec.homepage = "https://github.com/ts-3156/tinder-ruby"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.16"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "pry", "~> 0.11.3"
26
+
27
+ spec.add_runtime_dependency "dotenv", "~> 2.2.1"
28
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tinder-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ts-3156
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-03-06 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: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
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
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.11.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.11.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.2.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.2.1
69
+ description: A Ruby interface to the Tinder API
70
+ email:
71
+ - ts_3156@yahoo.co.jp
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - examples/change_location.rb
83
+ - lib/tinder.rb
84
+ - lib/tinder/client.rb
85
+ - lib/tinder/util.rb
86
+ - tinder-ruby.gemspec
87
+ homepage: https://github.com/ts-3156/tinder-ruby
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.5.2.1
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: A Ruby interface to the Tinder API
111
+ test_files: []