Class: Corraios::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/corraios/delivery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(correios_response) ⇒ Delivery

Returns a new instance of Delivery.



8
9
10
11
# File 'lib/corraios/delivery.rb', line 8

def initialize(correios_response)
  @amount_of_posts = 1
  parse_response(correios_response)
end

Instance Attribute Details

#amount_of_postsObject (readonly)

Returns the value of attribute amount_of_posts.



6
7
8
# File 'lib/corraios/delivery.rb', line 6

def amount_of_posts
  @amount_of_posts
end

#deadlineObject (readonly)

Returns the value of attribute deadline.



4
5
6
# File 'lib/corraios/delivery.rb', line 4

def deadline
  @deadline
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



4
5
6
# File 'lib/corraios/delivery.rb', line 4

def error_message
  @error_message
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/corraios/delivery.rb', line 4

def value
  @value
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/corraios/delivery.rb', line 13

def error?
  !!@error_message
end

#success?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/corraios/delivery.rb', line 17

def success?
  !error?
end