Class: PostCode
Constant Summary collapse
- @@url =
"https://viacep.com.br/ws"- @@header =
{"Content-Type" => "application/json"}
Instance Attribute Summary collapse
-
#header ⇒ Object
Returns the value of attribute header.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #get(url = @url, header = @header, postcode) ⇒ Object
-
#initialize(url = @@url, header = @@header) ⇒ PostCode
constructor
A new instance of PostCode.
Constructor Details
#initialize(url = @@url, header = @@header) ⇒ PostCode
Returns a new instance of PostCode.
11 12 13 14 |
# File 'lib/postcode_local.rb', line 11 def initialize(url=@@url, header=@@header) @url = url @header = header end |
Instance Attribute Details
#header ⇒ Object
Returns the value of attribute header.
6 7 8 |
# File 'lib/postcode_local.rb', line 6 def header @header end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/postcode_local.rb', line 6 def url @url end |
Instance Method Details
#get(url = @url, header = @header, postcode) ⇒ Object
16 17 18 |
# File 'lib/postcode_local.rb', line 16 def get(url=@url, header=@header, postcode) self.class.get("#{url}/#{postcode}/json/", :header => header) end |