tinderb 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 +39 -0
- data/.gitignore +237 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/tinderb/client.rb +29 -0
- data/lib/tinderb/request.rb +67 -0
- data/lib/tinderb/version.rb +5 -0
- data/lib/tinderb.rb +9 -0
- data/tinderb.gemspec +39 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cfd8059463f6cb7d3cae4a2ebddb1bb9106d98860f2f2a20797d4ef6199ee203
|
4
|
+
data.tar.gz: c543636ad157409415cce9f4caeecb9bef4717382d3df75633f8210eb63feb4c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74f63e4a84c191d14a6a81ddd08d1a73582f1ee8185498b8e9bcc59ddd640cbd34a7f5cde10a7cef9e8c06e4143b95b24146936ad9d02419290f1f755b7bfed5
|
7
|
+
data.tar.gz: 255bb31732944edda49e09b13ac785214432c98b85f087fe0f0fa35830561c509be6d7b36d72ed9f2b89f2765638a0f59a53b6081e27521d078b187eb1e851cd
|
@@ -0,0 +1,39 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
# specify the version you desire here
|
6
|
+
- image: circleci/ruby:2.5.1-node-browsers
|
7
|
+
|
8
|
+
environment:
|
9
|
+
- CIRCLE_ARTIFACTS: "/tmp/test-results"
|
10
|
+
|
11
|
+
working_directory: ~/repo
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- checkout
|
15
|
+
|
16
|
+
- run:
|
17
|
+
name: install dependencies
|
18
|
+
command: |
|
19
|
+
bundle install --jobs=4 --quiet --retry=3 --path vendor/bundle
|
20
|
+
|
21
|
+
# run tests!
|
22
|
+
- run:
|
23
|
+
name: run tests & code coverage
|
24
|
+
command: |
|
25
|
+
mkdir $CIRCLE_ARTIFACTS
|
26
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
27
|
+
bundle exec rspec --format progress \
|
28
|
+
--format RspecJunitFormatter \
|
29
|
+
--out $CIRCLE_ARTIFACTS/rspec.xml \
|
30
|
+
$TEST_FILES; ret=$?
|
31
|
+
bash <(curl -s https://codecov.io/bash) -t $CODECOVE_TOKEN
|
32
|
+
exit $ret
|
33
|
+
|
34
|
+
# collect reports
|
35
|
+
- store_test_results:
|
36
|
+
path: $CIRCLE_ARTIFACTS
|
37
|
+
- store_artifacts:
|
38
|
+
path: $CIRCLE_ARTIFACTS
|
39
|
+
destination: test-results
|
data/.gitignore
ADDED
@@ -0,0 +1,237 @@
|
|
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
|
+
### https://raw.github.com/github/gitignore/967cd6479319efde70a6fa44fa1bfa02020f2357/Ruby.gitignore
|
13
|
+
|
14
|
+
*.gem
|
15
|
+
*.rbc
|
16
|
+
/.config
|
17
|
+
/coverage/
|
18
|
+
/InstalledFiles
|
19
|
+
/pkg/
|
20
|
+
/spec/reports/
|
21
|
+
/spec/examples.txt
|
22
|
+
/test/tmp/
|
23
|
+
/test/version_tmp/
|
24
|
+
/tmp/
|
25
|
+
|
26
|
+
# Used by dotenv library to load environment variables.
|
27
|
+
# .env
|
28
|
+
|
29
|
+
## Specific to RubyMotion:
|
30
|
+
.dat*
|
31
|
+
.repl_history
|
32
|
+
build/
|
33
|
+
*.bridgesupport
|
34
|
+
build-iPhoneOS/
|
35
|
+
build-iPhoneSimulator/
|
36
|
+
|
37
|
+
## Specific to RubyMotion (use of CocoaPods):
|
38
|
+
#
|
39
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
40
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
41
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
42
|
+
#
|
43
|
+
# vendor/Pods/
|
44
|
+
|
45
|
+
## Documentation cache and generated files:
|
46
|
+
/.yardoc/
|
47
|
+
/_yardoc/
|
48
|
+
/doc/
|
49
|
+
/rdoc/
|
50
|
+
|
51
|
+
## Environment normalization:
|
52
|
+
/.bundle/
|
53
|
+
/vendor/bundle
|
54
|
+
/lib/bundler/man/
|
55
|
+
|
56
|
+
# for a library or gem, you might want to ignore these files since the code is
|
57
|
+
# intended to run in multiple environments; otherwise, check them in:
|
58
|
+
Gemfile.lock
|
59
|
+
# .ruby-version
|
60
|
+
# .ruby-gemset
|
61
|
+
|
62
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
63
|
+
.rvmrc
|
64
|
+
|
65
|
+
|
66
|
+
### https://raw.github.com/github/gitignore/967cd6479319efde70a6fa44fa1bfa02020f2357/Rails.gitignore
|
67
|
+
|
68
|
+
*.rbc
|
69
|
+
capybara-*.html
|
70
|
+
.rspec
|
71
|
+
/log
|
72
|
+
/tmp
|
73
|
+
/db/*.sqlite3
|
74
|
+
/db/*.sqlite3-journal
|
75
|
+
/public/system
|
76
|
+
/coverage/
|
77
|
+
/spec/tmp
|
78
|
+
*.orig
|
79
|
+
rerun.txt
|
80
|
+
pickle-email-*.html
|
81
|
+
|
82
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
83
|
+
config/initializers/secret_token.rb
|
84
|
+
config/master.key
|
85
|
+
|
86
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
87
|
+
# config/secrets.yml
|
88
|
+
|
89
|
+
# dotenv
|
90
|
+
# TODO Comment out this rule if environment variables can be committed
|
91
|
+
.env
|
92
|
+
|
93
|
+
## Environment normalization:
|
94
|
+
/.bundle
|
95
|
+
/vendor/bundle
|
96
|
+
|
97
|
+
# these should all be checked in to normalize the environment:
|
98
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
99
|
+
|
100
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
101
|
+
.rvmrc
|
102
|
+
|
103
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
104
|
+
/vendor/assets/bower_components
|
105
|
+
*.bowerrc
|
106
|
+
bower.json
|
107
|
+
|
108
|
+
# Ignore pow environment settings
|
109
|
+
.powenv
|
110
|
+
|
111
|
+
# Ignore Byebug command history file.
|
112
|
+
.byebug_history
|
113
|
+
|
114
|
+
# Ignore node_modules
|
115
|
+
node_modules/
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
### https://raw.github.com/github/gitignore/967cd6479319efde70a6fa44fa1bfa02020f2357/Global/Vim.gitignore
|
120
|
+
|
121
|
+
# Swap
|
122
|
+
[._]*.s[a-v][a-z]
|
123
|
+
[._]*.sw[a-p]
|
124
|
+
[._]s[a-rt-v][a-z]
|
125
|
+
[._]ss[a-gi-z]
|
126
|
+
[._]sw[a-p]
|
127
|
+
|
128
|
+
# Session
|
129
|
+
Session.vim
|
130
|
+
|
131
|
+
# Temporary
|
132
|
+
.netrwhist
|
133
|
+
*~
|
134
|
+
# Auto-generated tag files
|
135
|
+
tags
|
136
|
+
# Persistent undo
|
137
|
+
[._]*.un~
|
138
|
+
|
139
|
+
|
140
|
+
### https://raw.github.com/github/gitignore/967cd6479319efde70a6fa44fa1bfa02020f2357/Global/JetBrains.gitignore
|
141
|
+
|
142
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
143
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
144
|
+
|
145
|
+
# User-specific stuff
|
146
|
+
.idea/**/workspace.xml
|
147
|
+
.idea/**/tasks.xml
|
148
|
+
.idea/**/usage.statistics.xml
|
149
|
+
.idea/**/dictionaries
|
150
|
+
.idea/**/shelf
|
151
|
+
|
152
|
+
# Sensitive or high-churn files
|
153
|
+
.idea/**/dataSources/
|
154
|
+
.idea/**/dataSources.ids
|
155
|
+
.idea/**/dataSources.local.xml
|
156
|
+
.idea/**/sqlDataSources.xml
|
157
|
+
.idea/**/dynamic.xml
|
158
|
+
.idea/**/uiDesigner.xml
|
159
|
+
.idea/**/dbnavigator.xml
|
160
|
+
|
161
|
+
# Gradle
|
162
|
+
.idea/**/gradle.xml
|
163
|
+
.idea/**/libraries
|
164
|
+
|
165
|
+
# Gradle and Maven with auto-import
|
166
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
167
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
168
|
+
# auto-import.
|
169
|
+
# .idea/modules.xml
|
170
|
+
# .idea/*.iml
|
171
|
+
# .idea/modules
|
172
|
+
|
173
|
+
# CMake
|
174
|
+
cmake-build-*/
|
175
|
+
|
176
|
+
# Mongo Explorer plugin
|
177
|
+
.idea/**/mongoSettings.xml
|
178
|
+
|
179
|
+
# File-based project format
|
180
|
+
*.iws
|
181
|
+
|
182
|
+
# IntelliJ
|
183
|
+
out/
|
184
|
+
|
185
|
+
# mpeltonen/sbt-idea plugin
|
186
|
+
.idea_modules/
|
187
|
+
|
188
|
+
# JIRA plugin
|
189
|
+
atlassian-ide-plugin.xml
|
190
|
+
|
191
|
+
# Cursive Clojure plugin
|
192
|
+
.idea/replstate.xml
|
193
|
+
|
194
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
195
|
+
com_crashlytics_export_strings.xml
|
196
|
+
crashlytics.properties
|
197
|
+
crashlytics-build.properties
|
198
|
+
fabric.properties
|
199
|
+
|
200
|
+
# Editor-based Rest Client
|
201
|
+
.idea/httpRequests
|
202
|
+
|
203
|
+
|
204
|
+
### https://raw.github.com/github/gitignore/967cd6479319efde70a6fa44fa1bfa02020f2357/Global/macOS.gitignore
|
205
|
+
|
206
|
+
# General
|
207
|
+
.DS_Store
|
208
|
+
.AppleDouble
|
209
|
+
.LSOverride
|
210
|
+
|
211
|
+
# Icon must end with two \r
|
212
|
+
Icon
|
213
|
+
|
214
|
+
# Thumbnails
|
215
|
+
._*
|
216
|
+
|
217
|
+
# Files that might appear in the root of a volume
|
218
|
+
.DocumentRevisions-V100
|
219
|
+
.fseventsd
|
220
|
+
.Spotlight-V100
|
221
|
+
.TemporaryItems
|
222
|
+
.Trashes
|
223
|
+
.VolumeIcon.icns
|
224
|
+
.com.apple.timemachine.donotpresent
|
225
|
+
|
226
|
+
# Directories potentially created on remote AFP share
|
227
|
+
.AppleDB
|
228
|
+
.AppleDesktop
|
229
|
+
Network Trash Folder
|
230
|
+
Temporary Items
|
231
|
+
.apdisk
|
232
|
+
|
233
|
+
public/
|
234
|
+
.idea/
|
235
|
+
|
236
|
+
.envrc
|
237
|
+
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
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 pavegy@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
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Ryota Ikezawa
|
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,44 @@
|
|
1
|
+
[](https://circleci.com/gh/paveg/tinderb)
|
2
|
+
[](https://codecov.io/gh/paveg/tinderb)
|
3
|
+
|
4
|
+
# Tinderb
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'tinderb'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install tinderb
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'tinderb'
|
27
|
+
|
28
|
+
client = Tinderb.client.new(facebook_token: facebook_token, facebook_id: facebook_id)
|
29
|
+
client.authorize
|
30
|
+
|
31
|
+
# and more using apis...
|
32
|
+
```
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tinderb. 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.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Tinderb project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tinderb/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'tinderb'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tinderb'
|
4
|
+
require 'tinderb/request'
|
5
|
+
|
6
|
+
module Tinderb
|
7
|
+
class Client
|
8
|
+
include Request
|
9
|
+
|
10
|
+
def initialize(facebook_token: nil, facebook_id: nil)
|
11
|
+
@oauth_params = params(facebook_token, facebook_id)
|
12
|
+
end
|
13
|
+
|
14
|
+
def params(facebook_token, facebook_id)
|
15
|
+
{
|
16
|
+
facebook_token: ENV.fetch('FACEBOOK_TOKEN', facebook_token),
|
17
|
+
facebook_id: ENV.fetch('FACEBOOK_ID', facebook_id)
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def authorize
|
22
|
+
res = post(OAUTH_PATH, @oauth_params)
|
23
|
+
raise "error occurred. body: #{res.body}" unless res.status == 200
|
24
|
+
@token = res.body['token']
|
25
|
+
|
26
|
+
res
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
|
6
|
+
module Faraday
|
7
|
+
class Request
|
8
|
+
class TinderbOauth2 < Middleware
|
9
|
+
def initialize(app, token)
|
10
|
+
@app = app
|
11
|
+
@token = token
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
env[:request_headers]['X-Auth-Token'] ||= @token
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
register_middleware tinderb_oauth2: TinderbOauth2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Tinderb
|
24
|
+
module Request
|
25
|
+
def get(path, params = {})
|
26
|
+
request(:get, path, params)
|
27
|
+
end
|
28
|
+
|
29
|
+
def post(path, params = {})
|
30
|
+
request(:post, path, params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def put(path, params = {})
|
34
|
+
request(:put, path, params)
|
35
|
+
end
|
36
|
+
|
37
|
+
def delete(path, params = {})
|
38
|
+
request(:delete, path, params)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def request(method, path, params = {})
|
44
|
+
connection.send(method.to_sym, path, params).env
|
45
|
+
rescue Faraday::Error::ClientError
|
46
|
+
raise 'client error'
|
47
|
+
end
|
48
|
+
|
49
|
+
def connection
|
50
|
+
return @connection if instance_variable_defined?(:@connection) && @connection.headers.key?('X-Auth-Token')
|
51
|
+
|
52
|
+
@connection = Faraday.new(Tinderb::API_ENDPOINT) do |conn|
|
53
|
+
conn.request :tinderb_oauth2, @token if @token
|
54
|
+
conn.request :url_encoded
|
55
|
+
conn.request :json
|
56
|
+
assigne_header(conn)
|
57
|
+
conn.response :json, content_type: /\bjson$/
|
58
|
+
conn.adapter Faraday.default_adapter
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def assigne_header(conn)
|
63
|
+
conn.headers['User-agent'] ||= 'Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)'
|
64
|
+
conn.headers['Content-type'] ||= 'application/json'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/tinderb.rb
ADDED
data/tinderb.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'tinderb/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'tinderb'
|
9
|
+
spec.version = Tinderb::VERSION
|
10
|
+
spec.authors = ['Ryota Ikezawa']
|
11
|
+
spec.email = ['pavegy@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'API client of Tinder'
|
14
|
+
spec.description = 'This ruby gem is API client of tinder written by ruby launguage'
|
15
|
+
spec.homepage = 'https://github.com/paveg/tinderb'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_dependency 'codecov'
|
28
|
+
spec.add_dependency 'faraday', '~> 0.15'
|
29
|
+
spec.add_dependency 'faraday_middleware'
|
30
|
+
spec.add_dependency 'oauthenticator', '~> 1.3'
|
31
|
+
spec.add_dependency 'rspec_junit_formatter'
|
32
|
+
spec.add_dependency 'simplecov'
|
33
|
+
|
34
|
+
spec.add_development_dependency 'bundler', '~> 1.16.3'
|
35
|
+
spec.add_development_dependency 'pry-byebug'
|
36
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
37
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
38
|
+
spec.add_development_dependency 'rubocop'
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tinderb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryota Ikezawa
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: codecov
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.15'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.15'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday_middleware
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: oauthenticator
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec_junit_formatter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.16.3
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.16.3
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '10.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '10.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: This ruby gem is API client of tinder written by ruby launguage
|
168
|
+
email:
|
169
|
+
- pavegy@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".circleci/config.yml"
|
175
|
+
- ".gitignore"
|
176
|
+
- ".rspec"
|
177
|
+
- ".rubocop.yml"
|
178
|
+
- ".travis.yml"
|
179
|
+
- CODE_OF_CONDUCT.md
|
180
|
+
- Gemfile
|
181
|
+
- LICENSE.txt
|
182
|
+
- README.md
|
183
|
+
- Rakefile
|
184
|
+
- bin/console
|
185
|
+
- bin/setup
|
186
|
+
- lib/tinderb.rb
|
187
|
+
- lib/tinderb/client.rb
|
188
|
+
- lib/tinderb/request.rb
|
189
|
+
- lib/tinderb/version.rb
|
190
|
+
- tinderb.gemspec
|
191
|
+
homepage: https://github.com/paveg/tinderb
|
192
|
+
licenses:
|
193
|
+
- MIT
|
194
|
+
metadata: {}
|
195
|
+
post_install_message:
|
196
|
+
rdoc_options: []
|
197
|
+
require_paths:
|
198
|
+
- lib
|
199
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
requirements: []
|
210
|
+
rubyforge_project:
|
211
|
+
rubygems_version: 2.7.6
|
212
|
+
signing_key:
|
213
|
+
specification_version: 4
|
214
|
+
summary: API client of Tinder
|
215
|
+
test_files: []
|