jp_ems_fee 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 85f02aabf08983c1925eb9c7ace1b58932603d19
4
+ data.tar.gz: c54fcf50f561c24ec53d8f9775c97a0dd3187b50
5
+ SHA512:
6
+ metadata.gz: d21ad602c7a966626a7138e6d851f4a72f42fe69fb2c7e90b97cab59f8be2cd1b4513caecbf858e1d245d1a08ca4de92e3b784583b5c0f0c6e1eceacfb26ff70
7
+ data.tar.gz: 0f15919b515d2cb4bf0519f28c5bc7d049ef0a212794dac4a4a12c0884968ed70e000a59568dde0392b046bb0bf8d1b2d517def019fe496b255533eee0362558
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ #sudo: false
2
+ #language: ruby
3
+ #rvm:
4
+ # - 2.2.3
5
+ #before_install: gem install bundler -v 1.13.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jp_ems_fee.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Nishio Takuya
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.
@@ -0,0 +1,35 @@
1
+ # JpEmsFee
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'jp_ems_fee'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jp_ems_fee
18
+
19
+ ## Development
20
+
21
+ 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.
22
+
23
+ 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).
24
+
25
+ ## TODO
26
+ - [ ] Add Spec
27
+
28
+ ## Contributing
29
+
30
+ Bug reports and pull requests are welcome on GitHub at https://github.com/webuilder240/jp_ems_fee_ruby
31
+
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "jp_ems_fee"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,173 @@
1
+ ---
2
+ :asia:
3
+ 500: 1400
4
+ 600: 1540
5
+ 700: 1680
6
+ 800: 1820
7
+ 900: 1960
8
+ 1000: 2100
9
+ 1250: 2400
10
+ 1500: 2700
11
+ 1750: 3000
12
+ 2000: 3300
13
+ 2500: 3800
14
+ 3000: 4300
15
+ 3500: 4800
16
+ 4000: 5300
17
+ 4500: 5800
18
+ 5000: 6300
19
+ 5500: 6800
20
+ 6000: 7300
21
+ 7000: 8100
22
+ 8000: 8900
23
+ 9000: 9700
24
+ 10000: 10500
25
+ 11000: 11300
26
+ 12000: 12100
27
+ 13000: 12900
28
+ 14000: 13700
29
+ 15000: 14500
30
+ 16000: 15300
31
+ 17000: 16100
32
+ 18000: 16900
33
+ 19000: 17700
34
+ 20000: 18500
35
+ 21000: 19300
36
+ 22000: 20100
37
+ 23000: 20900
38
+ 24000: 21700
39
+ 25000: 22500
40
+ 26000: 23300
41
+ 27000: 24100
42
+ 28000: 24900
43
+ 29000: 25700
44
+ 30000: 26500
45
+ :oceania:
46
+ 500: 2000
47
+ 600: 2180
48
+ 700: 2360
49
+ 800: 2540
50
+ 900: 2720
51
+ 1000: 2900
52
+ 1250: 3300
53
+ 1500: 3700
54
+ 1750: 4100
55
+ 2000: 4500
56
+ 2500: 5200
57
+ 3000: 5900
58
+ 3500: 6600
59
+ 4000: 7300
60
+ 4500: 8000
61
+ 5000: 8700
62
+ 5500: 9400
63
+ 6000: 10100
64
+ 7000: 11200
65
+ 8000: 12300
66
+ 9000: 13400
67
+ 10000: 14500
68
+ 11000: 15600
69
+ 12000: 16700
70
+ 13000: 17800
71
+ 14000: 18900
72
+ 15000: 20000
73
+ 16000: 21100
74
+ 17000: 22200
75
+ 18000: 23300
76
+ 19000: 24400
77
+ 20000: 25500
78
+ 21000: 26600
79
+ 22000: 27700
80
+ 23000: 28800
81
+ 24000: 29900
82
+ 25000: 31000
83
+ 26000: 32100
84
+ 27000: 33200
85
+ 28000: 34300
86
+ 29000: 35400
87
+ 30000: 36500
88
+ :europa:
89
+ 500: 2200
90
+ 600: 2400
91
+ 700: 2600
92
+ 800: 2800
93
+ 900: 3000
94
+ 1000: 3200
95
+ 1250: 3650
96
+ 1500: 4100
97
+ 1750: 4550
98
+ 2000: 5000
99
+ 2500: 5800
100
+ 3000: 6600
101
+ 3500: 7400
102
+ 4000: 8200
103
+ 4500: 9000
104
+ 5000: 9800
105
+ 5500: 10600
106
+ 6000: 11400
107
+ 7000: 12700
108
+ 8000: 14000
109
+ 9000: 15300
110
+ 10000: 16600
111
+ 11000: 17900
112
+ 12000: 19200
113
+ 13000: 20500
114
+ 14000: 21800
115
+ 15000: 23100
116
+ 16000: 24400
117
+ 17000: 25700
118
+ 18000: 27000
119
+ 19000: 28300
120
+ 20000: 29600
121
+ 21000: 30900
122
+ 22000: 32200
123
+ 23000: 33500
124
+ 24000: 34800
125
+ 25000: 36100
126
+ 26000: 37400
127
+ 27000: 38700
128
+ 28000: 40000
129
+ 29000: 41300
130
+ 30000: 42600
131
+ :africa:
132
+ 500: 2400
133
+ 600: 2740
134
+ 700: 3080
135
+ 800: 3420
136
+ 900: 3760
137
+ 1000: 4100
138
+ 1250: 4900
139
+ 1500: 5700
140
+ 1750: 6500
141
+ 2000: 7300
142
+ 2500: 8800
143
+ 3000: 10300
144
+ 3500: 11800
145
+ 4000: 13300
146
+ 4500: 14800
147
+ 5000: 16300
148
+ 5500: 17800
149
+ 6000: 19300
150
+ 7000: 21400
151
+ 8000: 23500
152
+ 9000: 25600
153
+ 10000: 27700
154
+ 11000: 29800
155
+ 12000: 31900
156
+ 13000: 34000
157
+ 14000: 36100
158
+ 15000: 38200
159
+ 16000: 40300
160
+ 17000: 42400
161
+ 18000: 44500
162
+ 19000: 46600
163
+ 20000: 48700
164
+ 21000: 50800
165
+ 22000: 52900
166
+ 23000: 55000
167
+ 24000: 57100
168
+ 25000: 59200
169
+ 26000: 61300
170
+ 27000: 63400
171
+ 28000: 65500
172
+ 29000: 67600
173
+ 30000: 69700
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jp_ems_fee/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jp_ems_fee"
8
+ spec.version = JpEmsFee::VERSION
9
+ spec.authors = ["Nishio Takuya"]
10
+ spec.email = ["littlecub240@gmail.com"]
11
+ spec.summary = 'EMS delivery fee calculate from japan'
12
+ spec.description = 'JpEmsFee is EMS delivery fee calculate from japan'
13
+ spec.homepage = 'https://github.com/webuilder240/jp_ems_fee_ruby'
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ 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_development_dependency "bundler", "~> 1.13"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
@@ -0,0 +1,65 @@
1
+ require "jp_ems_fee/version"
2
+ require 'yaml'
3
+
4
+ module JpEmsFee
5
+ class << self
6
+
7
+ def asia(weight)
8
+ base(weight, __method__)
9
+ end
10
+
11
+ def oceania(weight)
12
+ base(weight, __method__)
13
+ end
14
+
15
+ def north_america(weight)
16
+ oceania(weight)
17
+ end
18
+
19
+ def middle_east(weight)
20
+ oceania(weight)
21
+ end
22
+
23
+ def central_america(weight)
24
+ oceania(weight)
25
+ end
26
+
27
+ def europa(weight)
28
+ base(weight, __method__)
29
+ end
30
+
31
+ def africa(weight)
32
+ base(weight, __method__)
33
+ end
34
+
35
+ def south_america(weight)
36
+ africa(weight)
37
+ end
38
+
39
+ private
40
+
41
+ def base(weight, method_name)
42
+ validate_weight_limit(weight)
43
+ calculate(weight, method_name)
44
+ end
45
+
46
+ def validate_weight_limit (weight)
47
+ if weight <= 0
48
+ raise 'Weight Limit Under'
49
+ elsif weight > 30000
50
+ raise 'Weight Limit Over'
51
+ end
52
+ end
53
+
54
+ def calculate(weight, area_name)
55
+ yaml = YAML.load_file(File.expand_path('../../ems_base_file.yaml', __FILE__))
56
+ yaml[area_name].each do |r|
57
+ if r.first >= weight
58
+ return r[1]
59
+ break
60
+ end
61
+ end
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,3 @@
1
+ module JpEmsFee
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jp_ems_fee
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nishio Takuya
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-10 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
+ description: JpEmsFee is EMS delivery fee calculate from japan
56
+ email:
57
+ - littlecub240@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - ems_base_file.yaml
72
+ - jp_ems_fee.gemspec
73
+ - lib/jp_ems_fee.rb
74
+ - lib/jp_ems_fee/version.rb
75
+ homepage: https://github.com/webuilder240/jp_ems_fee_ruby
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.4.5.1
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: EMS delivery fee calculate from japan
99
+ test_files: []
100
+ has_rdoc: