Class: Label

Inherits:
Object
  • Object
show all
Defined in:
lib/correios_api/label.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



2
3
4
# File 'lib/correios_api/label.rb', line 2

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/correios_api/label.rb', line 2

def name
  @name
end

#responseObject (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_fileObject



9
10
11
# File 'lib/correios_api/label.rb', line 9

def download_file
  File.write(@name, Base64.decode64(@data))
end