biggs 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +6 -2
- data/README.md +20 -20
- data/biggs.gemspec +1 -1
- data/lib/biggs/version.rb +1 -1
- metadata +4 -4
data/CHANGES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
### dev
|
2
2
|
|
3
|
+
### 0.3.3 / 2013-05-06
|
4
|
+
|
5
|
+
* Added support for Rails 4 (by [mdemare](https://github.com/mdemare))
|
6
|
+
|
3
7
|
### 0.3.2 / 2013-02-19
|
4
8
|
|
5
9
|
* Fixed warning in Biggs::Format
|
@@ -39,8 +43,8 @@
|
|
39
43
|
|
40
44
|
### 0.1.3 / 2009-3-6
|
41
45
|
|
42
|
-
* Correct japanese address format. [hiroshi]
|
43
|
-
* Fixed docs for current API. [hiroshi]
|
46
|
+
* Correct japanese address format. (by [hiroshi](https://github.com/hiroshi))
|
47
|
+
* Fixed docs for current API. (by [hiroshi](https://github.com/hiroshi))
|
44
48
|
|
45
49
|
### 0.1.2 / 2009-3-4
|
46
50
|
|
data/README.md
CHANGED
@@ -3,19 +3,19 @@ biggs is a small ruby gem/rails plugin for formatting postal addresses from over
|
|
3
3
|
### Install
|
4
4
|
|
5
5
|
As a ruby gem:
|
6
|
-
|
6
|
+
|
7
7
|
sudo gem install biggs
|
8
|
-
|
8
|
+
|
9
9
|
If your rather prefer to install it as a plugin for rails, from your application directory simply run:
|
10
|
-
|
10
|
+
|
11
11
|
script/plugin install git://github.com/yolk/biggs.git
|
12
12
|
|
13
13
|
### Standalone usage
|
14
|
-
|
14
|
+
|
15
15
|
f = Biggs::Formatter.new
|
16
|
-
|
16
|
+
|
17
17
|
f.format("de", # <= ISO alpha 2 code
|
18
|
-
:recipient => "Yolk Sebastian Munz & Julia Soergel GbR",
|
18
|
+
:recipient => "Yolk Sebastian Munz & Julia Soergel GbR",
|
19
19
|
:street => "Adalbertstr. 11", # <= street + house number
|
20
20
|
:city => "Berlin",
|
21
21
|
:zip => 10999,
|
@@ -23,7 +23,7 @@ If your rather prefer to install it as a plugin for rails, from your application
|
|
23
23
|
)
|
24
24
|
|
25
25
|
returns
|
26
|
-
|
26
|
+
|
27
27
|
"Yolk Sebastian Munz & Julia Soergel GbR
|
28
28
|
Adalbertstr. 11
|
29
29
|
10999 Berlin
|
@@ -32,9 +32,9 @@ returns
|
|
32
32
|
At the moment Biggs::Formatter.new accepts only one option:
|
33
33
|
|
34
34
|
*blank_county_on* ISO alpha 2 code (single string or array) of countries the formatter should skip the line "country" (for national shipping).
|
35
|
-
|
35
|
+
|
36
36
|
Biggs::Formatter.new(:blank_county_on => "de")
|
37
|
-
|
37
|
+
|
38
38
|
With the data from the above example this would return:
|
39
39
|
|
40
40
|
"Yolk Sebastian Munz & Julia Soergel GbR
|
@@ -46,24 +46,24 @@ With the data from the above example this would return:
|
|
46
46
|
Address < ActiveRecord::Base
|
47
47
|
biggs :postal_address
|
48
48
|
end
|
49
|
-
|
50
|
-
This adds the method postal_address to your Address-model, and assumes the presence of the methods/columns recipient, street, city, zip, state, and country to get the address data. Country should return the ISO-code (e.g. 'us', 'fr', 'de').
|
49
|
+
|
50
|
+
This adds the method postal_address to your Address-model, and assumes the presence of the methods/columns recipient, street, city, zip, state, and country to get the address data. Country should return the ISO-code (e.g. 'us', 'fr', 'de').
|
51
51
|
|
52
52
|
You can customize the method-names biggs will use by passing in a hash of options:
|
53
|
-
|
53
|
+
|
54
54
|
Address < ActiveRecord::Base
|
55
|
-
biggs :postal_address,
|
55
|
+
biggs :postal_address,
|
56
56
|
:zip => :postal_code,
|
57
57
|
:country => :country_code,
|
58
58
|
:street => Proc.new {|address| "#{address.street} #{address.house_number}" }
|
59
59
|
end
|
60
|
-
|
61
|
-
You can pass in a symbol to let biggs call a different method on your Address-model, or a Proc-object to create your data on the fly.
|
60
|
+
|
61
|
+
You can pass in a symbol to let biggs call a different method on your Address-model, or a Proc-object to create your data on the fly.
|
62
62
|
|
63
63
|
You can even pass in a array of symbols:
|
64
64
|
|
65
65
|
Address < ActiveRecord::Base
|
66
|
-
biggs :postal_address,
|
66
|
+
biggs :postal_address,
|
67
67
|
:recipient => [:company_name, :person_name]
|
68
68
|
end
|
69
69
|
|
@@ -72,9 +72,9 @@ This will call the methods company_name and person_name on your address-instance
|
|
72
72
|
To access the formatted address string, simply call the provided method on an address instance:
|
73
73
|
|
74
74
|
Address.find(1).postal_address
|
75
|
-
|
75
|
+
|
76
76
|
If you pass in a ISO alpha 2 code as :country that is not supported by biggs, it will choose the US-format for addresses with an state specified, and the french/german format for addresses without an state.
|
77
|
-
|
77
|
+
|
78
78
|
### Supported countries
|
79
79
|
|
80
80
|
biggs knows how to format addresses of over 60 different countries. If you are missing one or find an misstake, feel free to let us know, fork this repository and commit your additions.
|
@@ -145,6 +145,6 @@ biggs knows how to format addresses of over 60 different countries. If you are m
|
|
145
145
|
* United States of America
|
146
146
|
* Yemen
|
147
147
|
|
148
|
-
biggs is tested to behave well with Rails 3.0
|
148
|
+
biggs is tested to behave well with Rails 3.0, 3.1, 3.2 and 4.0
|
149
149
|
|
150
|
-
Copyright (c) 2009-
|
150
|
+
Copyright (c) 2009-2013 Yolk Sebastian Munz & Julia Soergel GbR
|
data/biggs.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency 'activerecord', '
|
22
|
+
s.add_dependency 'activerecord', '>= 3.0'
|
23
23
|
s.add_development_dependency 'rake'
|
24
24
|
s.add_development_dependency 'rspec', '>= 2.4.0'
|
25
25
|
s.add_development_dependency 'sqlite3', '>= 1.3.5'
|
data/lib/biggs/version.rb
CHANGED
metadata
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
name: biggs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sebastian Munz
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
none: false
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
prerelease: false
|
24
24
|
requirement: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ! '>='
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '3.0'
|
29
29
|
none: false
|