Class: Label
- Inherits:
-
Object
- Object
- Label
- Defined in:
- lib/correios_api/label.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #download_file ⇒ Object
-
#initialize(response) ⇒ Label
constructor
A new instance of Label.
Constructor Details
#initialize(response) ⇒ Label
Returns a new instance of Label.
3 4 5 6 7 |
# File 'lib/correios_api/label.rb', line 3 def initialize response @response = response @name = response.nome @data = response.dados end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
2 3 4 |
# File 'lib/correios_api/label.rb', line 2 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/correios_api/label.rb', line 2 def name @name end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
2 3 4 |
# File 'lib/correios_api/label.rb', line 2 def response @response end |
Instance Method Details
#download_file ⇒ Object
9 10 11 |
# File 'lib/correios_api/label.rb', line 9 def download_file File.write(@name, Base64.decode64(@data)) end |