gatorjuice_credit_rating 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6f17b37acc3c4fc5cf8147cef804faffaa6dce9
4
- data.tar.gz: f5c5161f0df44eccf5e3aba3a1939b79cb9bf1fd
3
+ metadata.gz: 9a29a964f12d56890937a8e9ef25908348981fac
4
+ data.tar.gz: 3c21ce17198e2b7c07f1b090903e4d2f60068f5d
5
5
  SHA512:
6
- metadata.gz: dac3e6a7b3211a25c59b50943311acea02307f62b32a3b861b262ac51e7fc3ccb66c923be2c12b87627532ad5d0c7c8b68e21e2a4c7f789f64769301cca2edfe
7
- data.tar.gz: 85b77790ce80fd732adb9a9b90f81b2e4f34b79293fe1d8d9ca56076c6235110bae68bd8aa5d65495e567732652edef35cd906502776b5e0bc6ba25b23e40954
6
+ metadata.gz: a815fcd3b6aa15cb694c7fb6403df246a0c3af7f2df454a4de105d461755033386ec2998908508d1a913d0d5d9fee32117e307c9043370e3184ac8e42b4e6e93
7
+ data.tar.gz: 9836eba8fbbdd2aed77c307d64d8bda22de5efcc2f1d993c2fad37b43ba70b410817bf965883a625df5e95bf4a5259c66c9f7f1f524b1793183451d390c981ce
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source 'https://rubygems.org'
2
-
3
2
  gem 'rspec'
4
3
 
5
4
  gemspec
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Finally! A tool for entering three pieces of information and getting arbitrary data back in order to make incredibly important decisions
4
4
 
5
+ ## Ruby Requirements
6
+
7
+ This gem requires ruby version 2.2.0
5
8
 
6
9
  ## Installation
7
10
 
@@ -20,6 +23,8 @@ Or install it yourself as:
20
23
  $ gem install gatorjuice_credit_rating
21
24
 
22
25
  ## Usage
26
+ Make sure you setup an environment variable called API_TOKEN with your unique token.
27
+
23
28
  ```ruby
24
29
  inquiry = GatorjuiceCreditRating::Assessment.inquiry(age: 40, income: 25000, zipcode: 60626)
25
30
 
@@ -9,23 +9,18 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jamie"]
10
10
  spec.email = ["gatorjuice@gmail.com"]
11
11
 
12
- spec.summary = %q{fake credit ranking}
13
- spec.description = %q{gives a fake credit ranking.}
12
+ spec.summary = "fake credit ranking"
13
+ spec.description = "gives a fake credit ranking"
14
14
  spec.homepage = "https://github.com/gatorjuice/gatorjuice_credit_rating"
15
15
 
16
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
- # delete this section to allow pushing this gem to any host.
18
- # if spec.respond_to?(:metadata)
19
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
- # else
21
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
- # end
23
-
24
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
17
  spec.bindir = "exe"
26
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
19
  spec.require_paths = ["lib"]
28
20
 
21
+ # specifying which ruby version
22
+ spec.required_ruby_version = '2.2.0'
23
+
29
24
  spec.add_development_dependency "bundler", "~> 1.9"
30
25
  spec.add_development_dependency "rake", "~> 10.0"
31
26
  spec.add_development_dependency "rspec", "3.4.0"
@@ -1,3 +1,3 @@
1
1
  module GatorjuiceCreditRating
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
@@ -11,17 +11,32 @@ module GatorjuiceCreditRating
11
11
  end
12
12
 
13
13
  def self.inquiry(input_options)
14
- if input_options[:age] && input_options[:income] && input_options[:zipcode]
15
- response = Unirest.get("http://jsonplaceholder.typicode.com/users?income=#{input_options[:income]}&age=#{input_options[:age]}&zipcode=#{input_options[:zipcode]}").body
16
- # assuming this was the actual endpoint, I'd get this response back
17
- response = {
18
- "propensity" => rand.round(5),
19
- "ranking" => %w(A B C D E F).sample
20
- }
21
- assessment = Assessment.new(response)
22
- return assessment
14
+ if
15
+ input_options[:age] &&
16
+ input_options[:age].to_i >= 18 &&
17
+ !!Integer(input_options[:age]) &&
18
+ input_options[:income] &&
19
+ input_options[:income].to_i > 0 &&
20
+ !!Integer(input_options[:income]) &&
21
+ input_options[:zipcode] &&
22
+ input_options[:zipcode].to_s.length == 5 &&
23
+ !!Integer(input_options[:zipcode]) &&
24
+ input_options.class == Hash
25
+ response = Unirest.get(
26
+ "https://pacific-stream-61271.herokuapp.com/api/v1/inquiries",
27
+ headers: {
28
+ "Accept" => "application/json"
29
+ },
30
+ parameters: {
31
+ age: input_options[:age].to_s,
32
+ income: input_options[:income].to_s,
33
+ zipcode: input_options[:zipcode],
34
+ api_token: "ABCDEFG1234567" # ENV[API_TOKEN]
35
+ }
36
+ ).body
37
+ response["response"] ? response["response"] : Assessment.new(response)
23
38
  else
24
- return "invalid inquiry"
39
+ raise ArgumentError, "#inquiry takes one hash as an argument and must have keys and numeric values for: age, income, zipcode"
25
40
  end
26
41
  end
27
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gatorjuice_credit_rating
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.1.2
69
- description: gives a fake credit ranking.
69
+ description: gives a fake credit ranking
70
70
  email:
71
71
  - gatorjuice@gmail.com
72
72
  executables: []
@@ -93,9 +93,9 @@ require_paths:
93
93
  - lib
94
94
  required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ">="
96
+ - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: '0'
98
+ version: 2.2.0
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="