Class: WhiplashApi::Shipnotice
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- WhiplashApi::Shipnotice
show all
- Defined in:
- lib/whiplash_api/shipnotice.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
connection, headers, reset_headers!, testing!
Class Method Details
.count(args = {}) ⇒ Object
19
20
21
|
# File 'lib/whiplash_api/shipnotice.rb', line 19
def count(args={})
self.get(:count, args)
end
|
.status_code_for(status) ⇒ Object
8
9
10
|
# File 'lib/whiplash_api/shipnotice.rb', line 8
def status_code_for(status)
status_mapping.invert[status.to_s.underscore.to_sym]
end
|
.status_for(status_code) ⇒ Object
5
6
7
|
# File 'lib/whiplash_api/shipnotice.rb', line 5
def status_for(status_code)
status_mapping[status_code].to_s.titleize
end
|
.update(id, args = {}) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/whiplash_api/shipnotice.rb', line 23
def update(id, args={})
response = self.put(id, {}, args.to_json)
response.code.to_i >= 200 && response.code.to_i < 300
rescue WhiplashApi::RecordNotFound
raise RecordNotFound, "No Shipment notice found with given ID."
end
|
.warehouse_code_for(warehouse) ⇒ Object
15
16
17
|
# File 'lib/whiplash_api/shipnotice.rb', line 15
def warehouse_code_for(warehouse)
warehouse_mapping.invert[warehouse]
end
|
.warehouse_for(warehouse_code) ⇒ Object
12
13
14
|
# File 'lib/whiplash_api/shipnotice.rb', line 12
def warehouse_for(warehouse_code)
warehouse_mapping[warehouse_code].to_s.titleize
end
|
Instance Method Details
#destroy ⇒ Object
64
65
66
|
# File 'lib/whiplash_api/shipnotice.rb', line 64
def destroy
self.class.delete(self.id)
end
|
#processed? ⇒ Boolean
60
61
62
|
# File 'lib/whiplash_api/shipnotice.rb', line 60
def processed?
self.status.to_i > 200
end
|
#received? ⇒ Boolean
56
57
58
|
# File 'lib/whiplash_api/shipnotice.rb', line 56
def received?
self.status.to_i > 100
end
|