Class: Postful::Service

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/postful/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(email, password) ⇒ Service

Returns a new instance of Service.



10
11
12
13
# File 'lib/postful/service.rb', line 10

def initialize(email, password)
  @email = email
  @password = password
end

Instance Method Details

#cancel_order_by_id(id) ⇒ Object



25
26
27
28
# File 'lib/postful/service.rb', line 25

def cancel_order_by_id(id)
  order = Postful::Order.new { @id = id }
  order.cancel
end

#find_all_ordersObject



30
31
32
33
34
35
36
37
38
# File 'lib/postful/service.rb', line 30

def find_all_orders
  response = get_request_on_path("/service/mail", @email, @password)
  case response.code
    when "200" then
      Postful::Order.build_all_from_response(response.body, @email, @password)
    else
      process_standard_responses(response)        
  end            
end

#find_order_by_id(id) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/postful/service.rb', line 15

def find_order_by_id(id)
  response = get_request_on_path("/service/mail/#{id}", @email, @password)
  case response.code
    when "200" then
      Postful::Order.build_from_response(response.body, @email, @password)
    else
      process_standard_responses(response)        
  end            
end