fuser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.relaxed.yml +165 -0
- data/.rubocop.yml +64 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/fuser.gemspec +30 -0
- data/lib/fuser.rb +31 -0
- data/lib/fuser/configuration.rb +5 -0
- data/lib/fuser/endpoint.rb +13 -0
- data/lib/fuser/request.rb +83 -0
- data/lib/fuser/response.rb +62 -0
- data/lib/fuser/version.rb +5 -0
- data/lib/i18n_config.rb +8 -0
- data/lib/locales/fuser.en.yml +52 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7dc251cb7fe77b076cfd79e4e4bf6c8495d9e8e88a659d512fb9949310807cab
|
4
|
+
data.tar.gz: 38a76b182bc8132fe426c420b926f5008fd54bba5ff2cce1a9f73b548f52598e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ec22dc44e0488b8f6e295714234d53ceea25114848b546b9c0a27624684ccdb23946e08f57efc49c29e3a4549a9f088e3645251e9f459b563e70ab8025c7b2c7
|
7
|
+
data.tar.gz: f77d55ba07cb628a765dbb64a2857b126124baf76104715127ce67449336092892f108200687838611a3e5c3cb63ce4349b91214fe39143964790e86064e02da
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
# Relaxed.Ruby.Style
|
2
|
+
## Version 2.2
|
3
|
+
|
4
|
+
Style/Alias:
|
5
|
+
Enabled: false
|
6
|
+
StyleGuide: http://relaxed.ruby.style/#stylealias
|
7
|
+
|
8
|
+
Style/AsciiComments:
|
9
|
+
Enabled: false
|
10
|
+
StyleGuide: http://relaxed.ruby.style/#styleasciicomments
|
11
|
+
|
12
|
+
Style/BeginBlock:
|
13
|
+
Enabled: false
|
14
|
+
StyleGuide: http://relaxed.ruby.style/#stylebeginblock
|
15
|
+
|
16
|
+
Style/BlockDelimiters:
|
17
|
+
Enabled: false
|
18
|
+
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
|
19
|
+
|
20
|
+
Style/CommentAnnotation:
|
21
|
+
Enabled: false
|
22
|
+
StyleGuide: http://relaxed.ruby.style/#stylecommentannotation
|
23
|
+
|
24
|
+
Style/Documentation:
|
25
|
+
Enabled: false
|
26
|
+
StyleGuide: http://relaxed.ruby.style/#styledocumentation
|
27
|
+
|
28
|
+
Layout/DotPosition:
|
29
|
+
Enabled: false
|
30
|
+
StyleGuide: http://relaxed.ruby.style/#layoutdotposition
|
31
|
+
|
32
|
+
Style/DoubleNegation:
|
33
|
+
Enabled: false
|
34
|
+
StyleGuide: http://relaxed.ruby.style/#styledoublenegation
|
35
|
+
|
36
|
+
Style/EndBlock:
|
37
|
+
Enabled: false
|
38
|
+
StyleGuide: http://relaxed.ruby.style/#styleendblock
|
39
|
+
|
40
|
+
Style/FormatString:
|
41
|
+
Enabled: false
|
42
|
+
StyleGuide: http://relaxed.ruby.style/#styleformatstring
|
43
|
+
|
44
|
+
Style/IfUnlessModifier:
|
45
|
+
Enabled: false
|
46
|
+
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
|
47
|
+
|
48
|
+
Style/Lambda:
|
49
|
+
Enabled: false
|
50
|
+
StyleGuide: http://relaxed.ruby.style/#stylelambda
|
51
|
+
|
52
|
+
Style/ModuleFunction:
|
53
|
+
Enabled: false
|
54
|
+
StyleGuide: http://relaxed.ruby.style/#stylemodulefunction
|
55
|
+
|
56
|
+
Style/MultilineBlockChain:
|
57
|
+
Enabled: false
|
58
|
+
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
|
59
|
+
|
60
|
+
Style/NegatedIf:
|
61
|
+
Enabled: false
|
62
|
+
StyleGuide: http://relaxed.ruby.style/#stylenegatedif
|
63
|
+
|
64
|
+
Style/NegatedWhile:
|
65
|
+
Enabled: false
|
66
|
+
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
|
67
|
+
|
68
|
+
Style/ParallelAssignment:
|
69
|
+
Enabled: false
|
70
|
+
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
|
71
|
+
|
72
|
+
Style/PercentLiteralDelimiters:
|
73
|
+
Enabled: false
|
74
|
+
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
|
75
|
+
|
76
|
+
Style/PerlBackrefs:
|
77
|
+
Enabled: false
|
78
|
+
StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs
|
79
|
+
|
80
|
+
Style/Semicolon:
|
81
|
+
Enabled: false
|
82
|
+
StyleGuide: http://relaxed.ruby.style/#stylesemicolon
|
83
|
+
|
84
|
+
Style/SignalException:
|
85
|
+
Enabled: false
|
86
|
+
StyleGuide: http://relaxed.ruby.style/#stylesignalexception
|
87
|
+
|
88
|
+
Style/SingleLineBlockParams:
|
89
|
+
Enabled: false
|
90
|
+
StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams
|
91
|
+
|
92
|
+
Style/SingleLineMethods:
|
93
|
+
Enabled: false
|
94
|
+
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
|
95
|
+
|
96
|
+
Layout/SpaceBeforeBlockBraces:
|
97
|
+
Enabled: false
|
98
|
+
StyleGuide: http://relaxed.ruby.style/#layoutspacebeforeblockbraces
|
99
|
+
|
100
|
+
Layout/SpaceInsideParens:
|
101
|
+
Enabled: false
|
102
|
+
StyleGuide: http://relaxed.ruby.style/#layoutspaceinsideparens
|
103
|
+
|
104
|
+
Style/SpecialGlobalVars:
|
105
|
+
Enabled: false
|
106
|
+
StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
|
107
|
+
|
108
|
+
Style/StringLiterals:
|
109
|
+
Enabled: false
|
110
|
+
StyleGuide: http://relaxed.ruby.style/#stylestringliterals
|
111
|
+
|
112
|
+
# Style/TrailingCommaInArguments:
|
113
|
+
# Enabled: false
|
114
|
+
# StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
|
115
|
+
#
|
116
|
+
# Style/TrailingCommaInArrayLiteral:
|
117
|
+
# Enabled: false
|
118
|
+
# StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarrayliteral
|
119
|
+
#
|
120
|
+
# Style/TrailingCommaInHashLiteral:
|
121
|
+
# Enabled: false
|
122
|
+
# StyleGuide: http://relaxed.ruby.style/#styletrailingcommainhashliteral
|
123
|
+
|
124
|
+
Style/WhileUntilModifier:
|
125
|
+
Enabled: false
|
126
|
+
StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
|
127
|
+
|
128
|
+
Style/WordArray:
|
129
|
+
Enabled: false
|
130
|
+
StyleGuide: http://relaxed.ruby.style/#stylewordarray
|
131
|
+
|
132
|
+
Lint/AmbiguousRegexpLiteral:
|
133
|
+
Enabled: false
|
134
|
+
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
|
135
|
+
|
136
|
+
Lint/AssignmentInCondition:
|
137
|
+
Enabled: false
|
138
|
+
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
|
139
|
+
|
140
|
+
Metrics/AbcSize:
|
141
|
+
Enabled: false
|
142
|
+
|
143
|
+
Metrics/BlockNesting:
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
Metrics/ClassLength:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
Metrics/ModuleLength:
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Metrics/CyclomaticComplexity:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Metrics/LineLength:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Metrics/MethodLength:
|
159
|
+
Enabled: false
|
160
|
+
|
161
|
+
Metrics/ParameterLists:
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
Metrics/PerceivedComplexity:
|
165
|
+
Enabled: false
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
inherit_from: .rubocop.relaxed.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
Exclude:
|
5
|
+
- __test/**
|
6
|
+
- spec/**/*
|
7
|
+
- Gemfile
|
8
|
+
- "*.gemspec"
|
9
|
+
- bundler/**/*
|
10
|
+
- vendor/bundle/**/* # travis with --deployment
|
11
|
+
TargetRubyVersion: 2.4
|
12
|
+
|
13
|
+
Style/PercentLiteralDelimiters:
|
14
|
+
PreferredDelimiters:
|
15
|
+
default: ()
|
16
|
+
'%i': '()'
|
17
|
+
'%I': '()'
|
18
|
+
'%r': '{}'
|
19
|
+
'%w': '()'
|
20
|
+
'%W': '()'
|
21
|
+
|
22
|
+
Style/FormatString:
|
23
|
+
EnforcedStyle: percent
|
24
|
+
|
25
|
+
Style/FrozenStringLiteralComment:
|
26
|
+
EnforcedStyle: always
|
27
|
+
|
28
|
+
Style/WordArray:
|
29
|
+
Enabled: true
|
30
|
+
MinSize: 3
|
31
|
+
|
32
|
+
Style/SymbolArray:
|
33
|
+
Enabled: true
|
34
|
+
MinSize: 3
|
35
|
+
|
36
|
+
Gemspec/OrderedDependencies:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/PerlBackrefs:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Layout/SpaceInsideParens:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Style/SpecialGlobalVars:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Style/Alias:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Style/BeginBlock:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Naming/UncommunicativeMethodParamName:
|
55
|
+
AllowedNames:
|
56
|
+
- cn
|
57
|
+
|
58
|
+
# new in 0.56, seems to give false-positivies
|
59
|
+
# https://github.com/bbatsov/rubocop/issues/5887
|
60
|
+
Lint/SplatKeywordArguments:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Metrics/BlockLength:
|
64
|
+
Enabled: false
|
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 dima.m@active-bridge.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/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fuser (0.1.0)
|
5
|
+
httparty (~> 0.16.2)
|
6
|
+
i18n (~> 1.1.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.5.2)
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
13
|
+
concurrent-ruby (1.0.5)
|
14
|
+
crack (0.4.3)
|
15
|
+
safe_yaml (~> 1.0.0)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
hashdiff (0.3.7)
|
18
|
+
httparty (0.16.2)
|
19
|
+
multi_xml (>= 0.5.2)
|
20
|
+
i18n (1.1.1)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
multi_xml (0.6.0)
|
23
|
+
public_suffix (3.0.3)
|
24
|
+
rake (10.5.0)
|
25
|
+
rspec (3.8.0)
|
26
|
+
rspec-core (~> 3.8.0)
|
27
|
+
rspec-expectations (~> 3.8.0)
|
28
|
+
rspec-mocks (~> 3.8.0)
|
29
|
+
rspec-core (3.8.0)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-expectations (3.8.1)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.8.0)
|
34
|
+
rspec-mocks (3.8.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.8.0)
|
37
|
+
rspec-support (3.8.0)
|
38
|
+
safe_yaml (1.0.4)
|
39
|
+
webmock (3.4.2)
|
40
|
+
addressable (>= 2.3.6)
|
41
|
+
crack (>= 0.3.2)
|
42
|
+
hashdiff
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
bundler (~> 1.16)
|
49
|
+
fuser!
|
50
|
+
rake (~> 10.0)
|
51
|
+
rspec (~> 3.0)
|
52
|
+
webmock (~> 3.4.2)
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
1.16.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 DeeMak13
|
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,37 @@
|
|
1
|
+
# Fuser
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'fuser'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install fuser
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
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.
|
24
|
+
|
25
|
+
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).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fuser. 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.
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
34
|
+
|
35
|
+
## Code of Conduct
|
36
|
+
|
37
|
+
Everyone interacting in the Fuser project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/fuser/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 'fuser'
|
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
data/fuser.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'fuser/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'fuser'
|
7
|
+
spec.version = Fuser::VERSION
|
8
|
+
spec.authors = ['DeeMak13']
|
9
|
+
spec.email = ['deemakk13@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = "Firebase Authentication and User Management"
|
12
|
+
spec.description = "Ruby wrapper for Firebase's native and third-party authentication."
|
13
|
+
spec.homepage = 'https://github.com/DeeMak13/fuser'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| 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_runtime_dependency 'httparty', '~> 0.16.2'
|
24
|
+
spec.add_runtime_dependency 'i18n', '~> 1.1', '>= 1.1.0'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
|
30
|
+
end
|
data/lib/fuser.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'i18n_config'
|
4
|
+
|
5
|
+
require 'fuser/version'
|
6
|
+
require 'fuser/configuration'
|
7
|
+
require 'fuser/endpoint'
|
8
|
+
require 'fuser/request'
|
9
|
+
require 'fuser/response'
|
10
|
+
|
11
|
+
module Fuser
|
12
|
+
class << self
|
13
|
+
attr_accessor :configuration
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configure
|
17
|
+
self.configuration ||= Configuration.new
|
18
|
+
yield(configuration)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.call(action, params)
|
22
|
+
request = Fuser::Request.call(action, params: params)
|
23
|
+
Fuser::Response.new(request.response, action: action)
|
24
|
+
end
|
25
|
+
|
26
|
+
I18n.t('fuser.endpoints').keys.each do |request_action|
|
27
|
+
define_singleton_method request_action do |params|
|
28
|
+
call(request_action, params)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
module Fuser
|
6
|
+
class Request
|
7
|
+
def self.call(*args)
|
8
|
+
new(*args).call
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(action, params:)
|
12
|
+
@action = action
|
13
|
+
@params = params
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
HTTParty.post(
|
18
|
+
Fuser::Endpoint.for(action),
|
19
|
+
body: request_body.to_json,
|
20
|
+
headers: default_request_headers
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_accessor :action, :params
|
27
|
+
|
28
|
+
def default_request_headers
|
29
|
+
{ 'Content-Type': 'application/json' }
|
30
|
+
end
|
31
|
+
|
32
|
+
def request_body
|
33
|
+
case action
|
34
|
+
when :verify_token then
|
35
|
+
{
|
36
|
+
'idToken': params[:token],
|
37
|
+
'returnSecureToken': true
|
38
|
+
}
|
39
|
+
when :refresh_token then
|
40
|
+
{
|
41
|
+
'grant_type': 'refresh_token',
|
42
|
+
'refresh_token': params[:token]
|
43
|
+
}
|
44
|
+
when :sign_in, :sign_up then
|
45
|
+
{
|
46
|
+
'email': params[:email],
|
47
|
+
'password': params[:password],
|
48
|
+
'returnSecureToken': true
|
49
|
+
}
|
50
|
+
when :anonymous_sign_in then
|
51
|
+
{
|
52
|
+
'returnSecureToken': true
|
53
|
+
}
|
54
|
+
when :reset_password then
|
55
|
+
{
|
56
|
+
'email': params[:email],
|
57
|
+
'requestType': 'PASSWORD_RESET'
|
58
|
+
}
|
59
|
+
when :verify_reset_password then
|
60
|
+
{
|
61
|
+
'oobCode': params[:oob_code]
|
62
|
+
}
|
63
|
+
when :confirm_reset_password then
|
64
|
+
{
|
65
|
+
'oobCode': params[:oob_code],
|
66
|
+
'newPassword': params[:new_password]
|
67
|
+
}
|
68
|
+
when :change_email then
|
69
|
+
{
|
70
|
+
'idToken': params[:token],
|
71
|
+
'email': params[:new_email],
|
72
|
+
'returnSecureToken': true
|
73
|
+
}
|
74
|
+
when :change_password then
|
75
|
+
{
|
76
|
+
'idToken': params[:token],
|
77
|
+
'email': params[:new_password],
|
78
|
+
'returnSecureToken': true
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Fuser
|
6
|
+
class Response
|
7
|
+
def initialize(response, action:)
|
8
|
+
@response = response
|
9
|
+
@action = action
|
10
|
+
end
|
11
|
+
|
12
|
+
def body
|
13
|
+
@body ||= JSON.parse(response.body, quirks_mode: true).tap do |parsed_response|
|
14
|
+
expand_error(parsed_response)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def raw_body
|
19
|
+
response.body
|
20
|
+
end
|
21
|
+
|
22
|
+
def success?
|
23
|
+
code == '200'
|
24
|
+
end
|
25
|
+
|
26
|
+
def code
|
27
|
+
response.code
|
28
|
+
end
|
29
|
+
|
30
|
+
def error_message
|
31
|
+
body.dig('error', 'message')
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_accessor :response, :action
|
37
|
+
|
38
|
+
def error_explanation(error_key)
|
39
|
+
I18n.t(
|
40
|
+
error_key.downcase,
|
41
|
+
scope: [:fuser, :errors, action],
|
42
|
+
default: default_error_message
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def default_error_message
|
47
|
+
I18n.t('fuser.errors.default')
|
48
|
+
end
|
49
|
+
|
50
|
+
def expand_error(parsed_response)
|
51
|
+
error_key = parsed_response.dig('error', 'message')
|
52
|
+
return unless error_key
|
53
|
+
|
54
|
+
parsed_response.deep_merge!(
|
55
|
+
'error' => {
|
56
|
+
'message' => error_explanation(error_key),
|
57
|
+
'key' => error_key
|
58
|
+
}
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/i18n_config.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
en:
|
2
|
+
fuser:
|
3
|
+
endpoints:
|
4
|
+
verify_token: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key=%{api_key}"
|
5
|
+
refresh_token: "https://securetoken.googleapis.com/v1/token?key=%{api_key}"
|
6
|
+
sign_up: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=%{api_key}"
|
7
|
+
sign_in: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=%{api_key}"
|
8
|
+
reset_password: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/getOobConfirmationCode?key=%{api_key}"
|
9
|
+
verify_reset_password: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/resetPassword?key=%{api_key}"
|
10
|
+
confirm_reset_password: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/resetPassword?key=%{api_key}"
|
11
|
+
change_email: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=%{api_key}"
|
12
|
+
change_password: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/setAccountInfo?key=%{api_key}"
|
13
|
+
errors:
|
14
|
+
default: "Something went wrong please try again."
|
15
|
+
sign_up:
|
16
|
+
email_exists: "The email address is already in use by another account."
|
17
|
+
operation_not_allowed: "Password sign-in is disabled for this project."
|
18
|
+
too_many_attempts_try_later: "We have blocked all requests from this device due to unusual activity. Try again later."
|
19
|
+
sign_in:
|
20
|
+
invalid_password: "The password is invalid or the user does not have a password."
|
21
|
+
user_disabled: "The user account has been disabled by an administrator."
|
22
|
+
email_not_found: "There is no user record corresponding to this identifier. The user may have been deleted."
|
23
|
+
anonymous_sign_in:
|
24
|
+
operation_not_allowed: "Anonymous user sign-in is disabled for this project."
|
25
|
+
verify_token:
|
26
|
+
invalid_custom_token: "The custom token format is incorrect or the token is invalid for some reason."
|
27
|
+
credential_mismatch: "The custom token corresponds to a different Firebase project."
|
28
|
+
refresh_token:
|
29
|
+
token_expired: "The user's credential is no longer valid. The user must sign in again."
|
30
|
+
user_disabled: "The user account has been disabled by an administrator."
|
31
|
+
user_not_found: "The user corresponding to the refresh token was not found. It is likely the user was deleted."
|
32
|
+
invalid_refresh_token: "An invalid refresh token is provided."
|
33
|
+
invalid_grant_type: "the grant type specified is invalid."
|
34
|
+
missing_refresh_token: "no refresh token provided."
|
35
|
+
reset_password:
|
36
|
+
email_not_found: "There is no user record corresponding to this identifier. The user may have been deleted."
|
37
|
+
verify_reset_password:
|
38
|
+
operation_not_allowed: "Password sign-in is disabled for this project."
|
39
|
+
expired_oob_code: "The action code has expired."
|
40
|
+
invalid_oob_code: "The action code is invalid. This can happen if the code is malformed, expired, or has already been used."
|
41
|
+
confirm_reset_password:
|
42
|
+
operation_not_allowed: "Password sign-in is disabled for this project."
|
43
|
+
expired_oob_code: "The action code has expired."
|
44
|
+
invalid_oob_code: "The action code is invalid. This can happen if the code is malformed, expired, or has already been used."
|
45
|
+
user_disabled: "The user account has been disabled by an administrator."
|
46
|
+
change_email:
|
47
|
+
email_exists: "The email address is already in use by another account."
|
48
|
+
invalid_id_token: "The user's credential is no longer valid. The user must sign in again."
|
49
|
+
change_password:
|
50
|
+
invalid_id_token: "The user's credential is no longer valid. The user must sign in again."
|
51
|
+
weak_password: "The password must be 6 characters long or more."
|
52
|
+
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fuser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- DeeMak13
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-10-15 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.16.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.16.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: i18n
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.1.0
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.1'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.1.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.16'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.16'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '10.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '10.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: webmock
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '3.4'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 3.4.2
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '3.4'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 3.4.2
|
109
|
+
description: Ruby wrapper for Firebase's native and third-party authentication.
|
110
|
+
email:
|
111
|
+
- deemakk13@gmail.com
|
112
|
+
executables: []
|
113
|
+
extensions: []
|
114
|
+
extra_rdoc_files: []
|
115
|
+
files:
|
116
|
+
- ".gitignore"
|
117
|
+
- ".rspec"
|
118
|
+
- ".rubocop.relaxed.yml"
|
119
|
+
- ".rubocop.yml"
|
120
|
+
- ".travis.yml"
|
121
|
+
- CODE_OF_CONDUCT.md
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- bin/console
|
128
|
+
- bin/setup
|
129
|
+
- fuser.gemspec
|
130
|
+
- lib/fuser.rb
|
131
|
+
- lib/fuser/configuration.rb
|
132
|
+
- lib/fuser/endpoint.rb
|
133
|
+
- lib/fuser/request.rb
|
134
|
+
- lib/fuser/response.rb
|
135
|
+
- lib/fuser/version.rb
|
136
|
+
- lib/i18n_config.rb
|
137
|
+
- lib/locales/fuser.en.yml
|
138
|
+
homepage: https://github.com/DeeMak13/fuser
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.7.6
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: Firebase Authentication and User Management
|
162
|
+
test_files: []
|