corraios 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a2f2d9a0311b5312ffe6009212d28b7ddc5051e
4
- data.tar.gz: d79b490315100b343cfb07ab616eaeb57db57095
3
+ metadata.gz: 1da6dbdd38ca9a24bcd8fed2d500bb1c41206c33
4
+ data.tar.gz: 3021f12d24b7428221c59cc1e5986afc96ee34db
5
5
  SHA512:
6
- metadata.gz: d0eea7dda003360aab2b0d3816838b8f130d1d23f885d16a0ca1b4f5df15449a0ca9b205cab90b6b555867a66246d72cd26337a7dd370c4a431bac6aedf4254b
7
- data.tar.gz: f5dfdb36865948edc5617980377009641c541d41dde0308a9a25ee6c07ad0f700d074c103b55dce084bfa1836d1b5f58708ecf921fcdf66072939ae961ab8d65
6
+ metadata.gz: 20afedbe71d98001e1282c92c606352bcdf4bb7e133688a12781ecc5a51514bf9cdbca5d3b0ea581af0345518f0e701a9755117041c4844804ff42b8a607e2d1
7
+ data.tar.gz: 1bbebc98833b501cda7d43942bdd9dd752506892733a45718f2a599f5ae4269742c92e17ee4d472bdd4b55a0d17f32c81c5b54867f91d33215d6ed38b297a0e7
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in corrails.gemspec
4
4
  gemspec
5
+
6
+
7
+ gem "codeclimate-test-reporter", group: :test, require: nil
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
- # Corraios
1
+ # Corraios [![Gem Version](https://badge.fury.io/rb/corraios.svg)](http://badge.fury.io/rb/corraios)
2
2
 
3
3
  [ ![Codeship Status for imaboldcompany/corrails](https://codeship.com/projects/b77b8780-9531-0132-ffbf-466960a0e7d2/status?branch=master)](https://codeship.com/projects/62768)
4
4
 
5
+ [![Code Climate](https://codeclimate.com/github/imaboldcompany/corraios/badges/gpa.svg)](https://codeclimate.com/github/imaboldcompany/corraios)
6
+
7
+ [![Test Coverage](https://codeclimate.com/github/imaboldcompany/corraios/badges/coverage.svg)](https://codeclimate.com/github/imaboldcompany/corraios)
8
+
5
9
  gem que visa facilitar o cálculo do valor do frete cobrado pelo Correios para entregas
6
10
  simples e para entregas com multiplos itens.
7
11
 
@@ -38,6 +38,12 @@ module Corraios
38
38
  end
39
39
  end
40
40
 
41
+ def assert_minimum_measures!
42
+ attributes_names.each do |attr|
43
+ send("#{attr}=", self.class.floor_for(attr, send(attr)))
44
+ end
45
+ end
46
+
41
47
  class << self
42
48
 
43
49
  def add_attribute name, restrictions, query_attribute_name = nil, round_value = true
@@ -24,6 +24,7 @@ module Corraios
24
24
  def merge!(other)
25
25
  self.weight += other.weight
26
26
  self.width = self.length = self.height = ((self.volume + other.volume) ** (1.0/3))
27
+ assert_minimum_measures!
27
28
  end
28
29
 
29
30
  def volume
@@ -33,7 +33,8 @@ module Corraios
33
33
  @containers << container
34
34
  else
35
35
  if container.is_a? :package
36
- add_package(container.to_package)
36
+ convert_containers_into_package unless using_package?
37
+ add_package(container)
37
38
  else
38
39
  add_envelope_or_roll container
39
40
  end
@@ -69,7 +70,7 @@ module Corraios
69
70
  end
70
71
 
71
72
  def using_package?
72
- @containers.any? { |container| container.is_a? :package }
73
+ @containers.all? { |container| container.is_a? :package }
73
74
  end
74
75
 
75
76
  def using_envelope?
@@ -1,3 +1,3 @@
1
1
  module Corraios
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corraios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Ra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty