square-charger 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in square-charger.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Rian Rainey
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Square Charger
2
+
3
+ Square Charger determines the amount of money to charge a customer to ensure you get the amount owed after Square takes their fees. Square charges variable fees based largely on the presence of the customer's credit card and can be burdensome. This gems helps alleviate that pain.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'square-charger'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install square-charger
18
+
19
+ ## Usage
20
+
21
+ From the Interactive Ruby Shell (irb) run the following command:
22
+
23
+ require 'square-charger'
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
32
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,29 @@
1
+ require "square-charger/version"
2
+
3
+ puts "--------------------------------------"
4
+ puts "---Welcome to the Square Calculator---"
5
+ puts "--------------------------------------"
6
+
7
+ # Output commas in large numbers
8
+ def comma_numbers(number, delimiter = ',')
9
+ number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, "\\1#{delimiter}").reverse
10
+ end
11
+
12
+ # Get Amount Owed
13
+ puts "\tHow much do you want to get paid?"
14
+ amount = gets.chomp # Read in from command line
15
+
16
+ # Is CC Present
17
+ puts "\tIs the credit card physically present? Enter Y or N"
18
+ ccPresent = gets.chomp
19
+
20
+ if ccPresent.downcase == "y" # CC is Present
21
+ transactionFee = 0.0275
22
+ total = amount.to_i / (1 - transactionFee)
23
+ else # CC is Absent
24
+ transactionFee = 0.035
25
+ fixedFee = 0.15
26
+ total = (amount.to_i + fixedFee) / (1 - transactionFee)
27
+ end
28
+
29
+ puts "The total amount to charge is: $#{ comma_numbers(total.round(2)) }"
@@ -0,0 +1,5 @@
1
+ module Square
2
+ module Charger
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'square-charger/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "square-charger"
8
+ gem.version = Square::Charger::VERSION
9
+ gem.authors = ["Rian Rainey"]
10
+ gem.email = ["rian@rianrainey.com"]
11
+ gem.description = %q{Calculate amount to charge customers to ensure you get the amount owed after Square takes their fees.}
12
+ gem.summary = %q{Square Charger determines the amount of money to charge a customer to ensure you
13
+ get the amount owed after Square takes their fees. Square charges variable fees
14
+ based largely on the presence of the customer's credit card and can be burdensome.
15
+ This gems helps alleviate that pain.}
16
+ gem.homepage = "https://github.com/rianrainey/Square-Charger"
17
+
18
+ gem.files = `git ls-files`.split($/)
19
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
20
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
+ gem.require_paths = ["lib"]
22
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: square-charger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rian Rainey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-22 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Calculate amount to charge customers to ensure you get the amount owed
15
+ after Square takes their fees.
16
+ email:
17
+ - rian@rianrainey.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/square-charger.rb
28
+ - lib/square-charger/version.rb
29
+ - square-charger.gemspec
30
+ homepage: https://github.com/rianrainey/Square-Charger
31
+ licenses: []
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.24
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Square Charger determines the amount of money to charge a customer to ensure
54
+ you get the amount owed after Square takes their fees. Square charges variable fees based
55
+ largely on the presence of the customer's credit card and can be burdensome. This
56
+ gems helps alleviate that pain.
57
+ test_files: []