peanut_labs 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +6 -0
- data/lib/peanut_labs.rb +10 -0
- data/lib/peanut_labs/builder/iframe_url.rb +44 -0
- data/lib/peanut_labs/builder/profile.rb +77 -0
- data/lib/peanut_labs/builder/user_id.rb +26 -0
- data/lib/peanut_labs/credentials.rb +31 -0
- data/lib/peanut_labs/direct_link.rb +27 -0
- data/lib/peanut_labs/errors.rb +7 -0
- data/lib/peanut_labs/parser/date_of_birth.rb +35 -0
- data/lib/peanut_labs/parser/sex.rb +17 -0
- data/lib/peanut_labs/version.rb +3 -0
- data/lib/peanut_labs/whitelist.rb +94 -0
- data/peanut_labs-0.1.0.gem +0 -0
- data/peanut_labs.gemspec +29 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9abfbdff356ec239294ffb974f6fdb29321b1a0d
|
4
|
+
data.tar.gz: 3761774821fa6dd7812c8d1804f063cfa6f2fa68
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 26ce15e9d916519e569591a20f727c4c8c2055df06b2af7308d0d0f35b3d71a70bef29d5c8bc34bcd93a5ac65f501be487835aba212998e7081c60d3268184fe
|
7
|
+
data.tar.gz: 71b225f669cb188725143167039a0defad1f90de01dc12db018f5f398e9ff61fa07a6a72f4df84a019c9236b1c0f5ce8f1f47451d6b2122170392ec65ed0d417
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.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 lunaticman@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) 2017 Stanislav K
|
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,45 @@
|
|
1
|
+
|
2
|
+
[![Build Status](https://travis-ci.org/saberespoder/peanut_labs.svg?branch=master)](https://travis-ci.org/saberespoder/peanut_labs)
|
3
|
+
|
4
|
+
# PeanutLabs
|
5
|
+
This is a helper library for PeanutLabs.com integration.
|
6
|
+
|
7
|
+
Currently features include:
|
8
|
+
- Building iframe for survey wall
|
9
|
+
- Building DirectLinks
|
10
|
+
- Whitelisting routes in rails
|
11
|
+
|
12
|
+
Documentation is here: http://peanut-labs.github.io/publisher-doc/index.html#iframe-getuserid
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'peanut_labs'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install peanut_labs
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
Follow the code, Luke (c)
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
Be a good lad and write specs, we love code we can rely on.
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/saberespoder/peanut_labs.
|
40
|
+
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
45
|
+
|
data/Rakefile
ADDED
data/lib/peanut_labs.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "peanut_labs/version"
|
2
|
+
require 'peanut_labs/builder/user_id'
|
3
|
+
require 'peanut_labs/builder/profile'
|
4
|
+
require 'peanut_labs/errors'
|
5
|
+
require 'peanut_labs/builder/iframe_url'
|
6
|
+
require 'peanut_labs/direct_link'
|
7
|
+
|
8
|
+
module PeanutLabs
|
9
|
+
# Your code goes here...
|
10
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative '../credentials'
|
2
|
+
require_relative '../parser/sex'
|
3
|
+
require_relative '../parser/date_of_birth'
|
4
|
+
require_relative '../errors'
|
5
|
+
|
6
|
+
module PeanutLabs
|
7
|
+
module Builder
|
8
|
+
class IframeUrl
|
9
|
+
ENDPOINT = 'https://www.peanutlabs.com/userGreeting.php'.freeze
|
10
|
+
|
11
|
+
def initialize(params=nil)
|
12
|
+
@credentials = Credentials.new(params)
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# Documentation here: http://peanut-labs.github.io/publisher-doc/index.html#iframe-optionalpara
|
17
|
+
#
|
18
|
+
# Accepts these parameters
|
19
|
+
# params[:id] -> required, specially encoded from peanut labs user_id
|
20
|
+
# params[:dob] -> not required, classes accepted - Date, DateTime, Time or formatted "MM-DD-YYYY" string
|
21
|
+
# params[:sex] -> not required, 1 for male, 2 for female
|
22
|
+
#
|
23
|
+
def call(params)
|
24
|
+
raise PeanutLabs::UserIdMissingError if params[:id].nil? || params[:id].empty?
|
25
|
+
|
26
|
+
result = "#{ENDPOINT}?userId=#{UserId.new(credentials: credentials).call(params[:id])}"
|
27
|
+
|
28
|
+
if (sex = PeanutLabs::Parser::Sex.call(params[:sex]))
|
29
|
+
result << "&sex=#{sex}"
|
30
|
+
end
|
31
|
+
|
32
|
+
if (dob = PeanutLabs::Parser::DateOfBirth.iframe(params[:dob]))
|
33
|
+
result << "&dob=#{dob}"
|
34
|
+
end
|
35
|
+
|
36
|
+
result
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
attr_accessor :credentials
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require_relative '../credentials'
|
2
|
+
require_relative '../parser/date_of_birth'
|
3
|
+
require_relative 'user_id'
|
4
|
+
|
5
|
+
module PeanutLabs
|
6
|
+
module Builder
|
7
|
+
class Profile
|
8
|
+
COUNTRY_CODES = %w(
|
9
|
+
AF AX AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BA BW BV BR VG KH CM CA CV KY
|
10
|
+
CF TD CL CN HK MO CX CC CO KM CG CD CK CR CI HR CU CY CZ DK DJ DM DO EC EG SV GQ ER EE ET FK FO BN BG BF BI IO
|
11
|
+
FJ FI FR GF PF TF GA GM GE DE GH GI GR GL GD GP GU GT GG GN GW GY HT HM VA HN HU IS IN ID IR IQ IE IM IL IT JM
|
12
|
+
JP JE JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MK MG MW MY MV ML MT MH MQ MR MU YT MX FM MD MC MN ME
|
13
|
+
MS MA MZ MM NA NR NP NL AN NC NZ NI NE NG NU NF MP NO OM PK PW PS PA PG PY PE PH PN PL PT PR QA RE RO RU RW BL
|
14
|
+
SH KN LC MF PM VC WS SM ST SA SN RS SC SL SG SK SI SB SO ZA GS SS ES LK SD SR SJ SZ SE CH SY TW TJ TZ TH TL TG
|
15
|
+
TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VE VN VI WF EH YE ZM ZW
|
16
|
+
).freeze
|
17
|
+
|
18
|
+
def initialize(params = nil)
|
19
|
+
@credentials = params[:credentials] || PeanutLabs::Credentials.new(params)
|
20
|
+
end
|
21
|
+
|
22
|
+
# This class build a user profile and validates following parameters:
|
23
|
+
#
|
24
|
+
# - params[:user_id] - mandatory, will be later built to user_go_id
|
25
|
+
# - params[:cc] - mandatory, will be validated for correctness
|
26
|
+
# - params[:dob] - mandatory, all DateTime, Time, Date object will be formatted, already formatted string is accepted
|
27
|
+
# - params[:sex] - mandatory, will attempt to interpret any common definitions of SEX
|
28
|
+
#
|
29
|
+
# more info http://peanut-labs.github.io/publisher-doc/index.html#iv-payload
|
30
|
+
#
|
31
|
+
# you can map more parameters, you can find mapping for additional fields here:
|
32
|
+
# https://docs.google.com/spreadsheets/d/1v-qYMKBUVGNTrG4BSL_hIYsg9v_eLMBfehETtAqg240/edit#gid=1572744670
|
33
|
+
|
34
|
+
def call(params)
|
35
|
+
raise PeanutLabs::UserIdMissingError if params[:user_id].nil?
|
36
|
+
raise PeanutLabs::DateOfBirthMissingError if params[:dob].nil?
|
37
|
+
raise PeanutLabs::SexMissingError if params[:sex].nil?
|
38
|
+
raise PeanutLabs::CountryMissingError if params[:country].nil?
|
39
|
+
|
40
|
+
{
|
41
|
+
user_id: UserId.new(credentials: credentials).call(params[:user_id]),
|
42
|
+
cc: country(params[:country]),
|
43
|
+
dob: date_of_birth(params[:dob]),
|
44
|
+
sex: sex(params[:sex])
|
45
|
+
}.to_json
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
attr_reader :credentials
|
51
|
+
|
52
|
+
def country(value)
|
53
|
+
if COUNTRY_CODES.include? value
|
54
|
+
value
|
55
|
+
else
|
56
|
+
raise PeanutLabs::CountryMissingError.new("Wrong value provided #{value}")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def sex(value)
|
61
|
+
if (sex = PeanutLabs::Parser::Sex.call(value))
|
62
|
+
sex
|
63
|
+
else
|
64
|
+
raise PeanutLabs::SexMissingError.new("Wrong value provided #{value}")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def date_of_birth(value)
|
69
|
+
if (dob = PeanutLabs::Parser::DateOfBirth.profile(value))
|
70
|
+
dob
|
71
|
+
else
|
72
|
+
raise PeanutLabs::DateOfBirthMissingError.new("Wrong value provided #{value}")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative '../credentials'
|
2
|
+
require 'digest'
|
3
|
+
|
4
|
+
module PeanutLabs
|
5
|
+
module Builder
|
6
|
+
class UserId
|
7
|
+
# Documentation is here: http://peanut-labs.github.io/publisher-doc/index.html#iframe-getuserid
|
8
|
+
|
9
|
+
def initialize(params = nil)
|
10
|
+
@credentials = params[:credentials] || PeanutLabs::Credentials.new(params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(public_user_id)
|
14
|
+
"#{public_user_id}-#{credentials.id}-#{user_go(public_user_id)}"
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_accessor :credentials
|
20
|
+
|
21
|
+
def user_go(public_user_id)
|
22
|
+
Digest::MD5.hexdigest("#{public_user_id}#{credentials.id}#{credentials.key}")[0..9]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'errors'
|
2
|
+
|
3
|
+
module PeanutLabs
|
4
|
+
class Credentials
|
5
|
+
DEFAULT_PARAMS = { app_id: nil, app_key: nil }.freeze
|
6
|
+
|
7
|
+
# accepts params for app credentials or tries to retrieve them from ENV variables
|
8
|
+
#
|
9
|
+
# params[:app_id] = application id provided by peanut labs
|
10
|
+
# params[:app_key] = application key provided by peanut labs
|
11
|
+
#
|
12
|
+
# or provide via ENV variable
|
13
|
+
#
|
14
|
+
# ENV['PEANUTLABS_ID']
|
15
|
+
# ENV['PEANUTLABS_KEY']
|
16
|
+
|
17
|
+
attr_accessor :id, :key
|
18
|
+
|
19
|
+
def initialize(params=nil)
|
20
|
+
params ||= DEFAULT_PARAMS
|
21
|
+
|
22
|
+
@id = params[:app_id] || ENV['PEANUTLABS_ID']
|
23
|
+
@key = params[:app_key] || ENV['PEANUTLABS_KEY']
|
24
|
+
|
25
|
+
if id.nil? || key.nil? || id.empty? || key.empty?
|
26
|
+
raise PeanutLabs::CredentialsMissingError
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'builder/user_id'
|
2
|
+
|
3
|
+
module PeanutLabs
|
4
|
+
class DirectLink
|
5
|
+
ENDPOINT = "https://dlink.peanutlabs.com/direct_link".freeze
|
6
|
+
|
7
|
+
def initialize(params={})
|
8
|
+
@credentials = params[:credentials] || Credentials.new(params)
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(user_id, sub_id=nil)
|
12
|
+
raise UserIdMissingError if user_id.nil? || user_id.empty?
|
13
|
+
|
14
|
+
result = "#{ENDPOINT}/?pub_id=#{credentials.id}&user_id=#{Builder::UserId.new(credentials: credentials).call(user_id)}"
|
15
|
+
|
16
|
+
if sub_id
|
17
|
+
result << "&sub_id=#{sub_id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
result
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_accessor :credentials
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module PeanutLabs
|
2
|
+
class CredentialsMissingError < StandardError; end
|
3
|
+
class UserIdMissingError < StandardError; end
|
4
|
+
class DateOfBirthMissingError < StandardError; end
|
5
|
+
class SexMissingError < StandardError; end
|
6
|
+
class CountryMissingError < StandardError; end
|
7
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module PeanutLabs
|
4
|
+
module Parser
|
5
|
+
class DateOfBirth
|
6
|
+
class << self
|
7
|
+
# This method formats DateTime, Date, Time to time format required for Iframe (MM-DD-YYYY)
|
8
|
+
# It also checks if string is already formatted correctly
|
9
|
+
# Can return NIL
|
10
|
+
|
11
|
+
def iframe(value)
|
12
|
+
retrieve_date(value, /^\d{2}-\d{2}-\d{4}$/, '%m-%d-%Y')
|
13
|
+
end
|
14
|
+
|
15
|
+
# This method formats DateTime, Date, Time to time format required for Profile class (YYYY-MM-DD)
|
16
|
+
# It also checks if string is already formatted correctly
|
17
|
+
# Can return NIL
|
18
|
+
|
19
|
+
def profile(value)
|
20
|
+
retrieve_date(value, /^\d{4}-\d{2}-\d{2}$/, '%Y-%m-%d')
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def retrieve_date(value, correct_regexp, format_as)
|
26
|
+
return value if value.nil?
|
27
|
+
return value.strftime(format_as) if value.is_a?(Date) || value.is_a?(DateTime) || value.is_a?(Time)
|
28
|
+
return value if value.match?(correct_regexp)
|
29
|
+
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module PeanutLabs
|
2
|
+
module Parser
|
3
|
+
class Sex
|
4
|
+
MALE = %w[1 m male].freeze
|
5
|
+
FEMALE = %w[2 f female].freeze
|
6
|
+
|
7
|
+
def self.call(value)
|
8
|
+
return value.to_s if value.is_a?(Integer) && value < 3 && value.positive?
|
9
|
+
return nil if value.is_a?(Integer) || value.nil?
|
10
|
+
return '1' if MALE.include? value.downcase
|
11
|
+
return '2' if FEMALE.include? value.downcase
|
12
|
+
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module PeanutLabs
|
2
|
+
class Whitelist
|
3
|
+
# This should be used in rails routes.rb file, like this:
|
4
|
+
#
|
5
|
+
# post "callback/peanutlabs" => "callback#peanutlabs", constraints: PeanutLabs::Whitelist
|
6
|
+
#
|
7
|
+
|
8
|
+
RN_IPS = ['75.101.154.153',
|
9
|
+
'54.243.235.176',
|
10
|
+
'54.243.210.15',
|
11
|
+
'54.243.204.6',
|
12
|
+
'54.243.150.156',
|
13
|
+
'54.243.150.126',
|
14
|
+
'54.243.149.248',
|
15
|
+
'54.243.149.247',
|
16
|
+
'54.243.146.21',
|
17
|
+
'54.243.143.97',
|
18
|
+
'50.19.92.139',
|
19
|
+
'50.17.194.132',
|
20
|
+
'50.17.193.185',
|
21
|
+
'50.17.191.62',
|
22
|
+
'50.17.191.143',
|
23
|
+
'50.17.190.69',
|
24
|
+
'50.17.190.174',
|
25
|
+
'50.17.189.251',
|
26
|
+
'50.17.189.201',
|
27
|
+
'50.17.189.138',
|
28
|
+
'50.17.187.32',
|
29
|
+
'50.17.187.218',
|
30
|
+
'50.17.187.192',
|
31
|
+
'50.17.187.145',
|
32
|
+
'50.17.186.7',
|
33
|
+
'50.17.186.39',
|
34
|
+
'50.17.184.98',
|
35
|
+
'50.17.184.153',
|
36
|
+
'50.17.182.38',
|
37
|
+
'50.17.182.19',
|
38
|
+
'50.17.182.17',
|
39
|
+
'50.17.181.130',
|
40
|
+
'50.17.181.118',
|
41
|
+
'50.17.181.11',
|
42
|
+
'50.16.250.192',
|
43
|
+
'50.16.249.58',
|
44
|
+
'50.16.249.162',
|
45
|
+
'50.16.245.185',
|
46
|
+
'50.16.243.67',
|
47
|
+
'50.16.241.60',
|
48
|
+
'50.16.239.186',
|
49
|
+
'50.16.236.39',
|
50
|
+
'23.21.123.40',
|
51
|
+
'184.73.254.159',
|
52
|
+
'184.73.254.133',
|
53
|
+
'184.73.250.161',
|
54
|
+
'184.73.249.128',
|
55
|
+
'184.73.244.77',
|
56
|
+
'184.73.196.208',
|
57
|
+
'184.73.166.67',
|
58
|
+
'184.73.158.48',
|
59
|
+
'184.73.153.111',
|
60
|
+
'184.72.230.119',
|
61
|
+
'184.72.222.51',
|
62
|
+
'184.72.222.104',
|
63
|
+
'184.72.221.219',
|
64
|
+
'174.129.37.199',
|
65
|
+
'174.129.242.30',
|
66
|
+
'174.129.240.137',
|
67
|
+
'174.129.238.17',
|
68
|
+
'174.129.237.1',
|
69
|
+
'174.129.22.190',
|
70
|
+
'174.129.219.230',
|
71
|
+
'174.129.209.23',
|
72
|
+
'174.129.209.2',
|
73
|
+
'107.22.164.69',
|
74
|
+
'107.22.164.67',
|
75
|
+
'107.22.164.59',
|
76
|
+
'107.22.164.55',
|
77
|
+
'107.22.164.53',
|
78
|
+
'107.22.164.5',
|
79
|
+
'107.22.162.83',
|
80
|
+
'107.22.160.89',
|
81
|
+
'107.22.160.31',
|
82
|
+
'107.22.160.14',
|
83
|
+
'107.20.248.88',
|
84
|
+
'107.20.246.140',
|
85
|
+
'107.20.235.89',
|
86
|
+
'107.20.201.76',
|
87
|
+
'107.20.152.198'].freeze
|
88
|
+
|
89
|
+
def self.matches?(request)
|
90
|
+
!RN_IPS.include?(request.remote_ip)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
Binary file
|
data/peanut_labs.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'peanut_labs/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "peanut_labs"
|
8
|
+
spec.version = PeanutLabs::VERSION
|
9
|
+
spec.authors = ["Stanislav K"]
|
10
|
+
spec.email = ["tech@saberespoder.com"]
|
11
|
+
|
12
|
+
spec.summary = "Gem for integration with peanutlabs.com"
|
13
|
+
spec.description = "Provides simple wrappers for functionality: Whitelist for routes, DirectLink building and Iframe url generation"
|
14
|
+
spec.homepage = "http://www.github.com/saberespoder/peanut_labs"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.required_ruby_version = ">= 2.4"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "timecop", "~> 0.8"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: peanut_labs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stanislav K
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-27 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.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: timecop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
description: 'Provides simple wrappers for functionality: Whitelist for routes, DirectLink
|
70
|
+
building and Iframe url generation'
|
71
|
+
email:
|
72
|
+
- tech@saberespoder.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".ruby-version"
|
80
|
+
- ".travis.yml"
|
81
|
+
- CODE_OF_CONDUCT.md
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- lib/peanut_labs.rb
|
87
|
+
- lib/peanut_labs/builder/iframe_url.rb
|
88
|
+
- lib/peanut_labs/builder/profile.rb
|
89
|
+
- lib/peanut_labs/builder/user_id.rb
|
90
|
+
- lib/peanut_labs/credentials.rb
|
91
|
+
- lib/peanut_labs/direct_link.rb
|
92
|
+
- lib/peanut_labs/errors.rb
|
93
|
+
- lib/peanut_labs/parser/date_of_birth.rb
|
94
|
+
- lib/peanut_labs/parser/sex.rb
|
95
|
+
- lib/peanut_labs/version.rb
|
96
|
+
- lib/peanut_labs/whitelist.rb
|
97
|
+
- peanut_labs-0.1.0.gem
|
98
|
+
- peanut_labs.gemspec
|
99
|
+
homepage: http://www.github.com/saberespoder/peanut_labs
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '2.4'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.6.8
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Gem for integration with peanutlabs.com
|
123
|
+
test_files: []
|