Class: Corraios::Delivery
- Inherits:
-
Object
- Object
- Corraios::Delivery
- Defined in:
- lib/corraios/delivery.rb
Instance Attribute Summary collapse
-
#amount_of_posts ⇒ Object
readonly
Returns the value of attribute amount_of_posts.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#deadline ⇒ Object
readonly
Returns the value of attribute deadline.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(correios_response, service_name, service_code) ⇒ Delivery
constructor
A new instance of Delivery.
- #success? ⇒ Boolean
Constructor Details
#initialize(correios_response, service_name, service_code) ⇒ Delivery
Returns a new instance of Delivery.
9 10 11 12 13 14 |
# File 'lib/corraios/delivery.rb', line 9 def initialize(correios_response, service_name, service_code) @name = service_name @code = service_code @amount_of_posts = 1 parse_response(correios_response) end |
Instance Attribute Details
#amount_of_posts ⇒ Object (readonly)
Returns the value of attribute amount_of_posts.
7 8 9 |
# File 'lib/corraios/delivery.rb', line 7 def amount_of_posts @amount_of_posts end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/corraios/delivery.rb', line 4 def code @code end |
#deadline ⇒ Object (readonly)
Returns the value of attribute deadline.
5 6 7 |
# File 'lib/corraios/delivery.rb', line 5 def deadline @deadline end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
5 6 7 |
# File 'lib/corraios/delivery.rb', line 5 def end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/corraios/delivery.rb', line 4 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/corraios/delivery.rb', line 5 def value @value end |
Instance Method Details
#error? ⇒ Boolean
16 17 18 |
# File 'lib/corraios/delivery.rb', line 16 def error? !! end |
#success? ⇒ Boolean
20 21 22 |
# File 'lib/corraios/delivery.rb', line 20 def success? !error? end |