Class: EmailDirect::OrderItem
- Inherits:
-
Object
- Object
- EmailDirect::OrderItem
- Defined in:
- lib/emaildirect/order_item.rb
Overview
Represents an OrderItem and associated functionality
Instance Attribute Summary collapse
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #details ⇒ Object
-
#initialize(item_id) ⇒ OrderItem
constructor
A new instance of OrderItem.
- #update(email, options) ⇒ Object
Constructor Details
#initialize(item_id) ⇒ OrderItem
Returns a new instance of OrderItem.
28 29 30 |
# File 'lib/emaildirect/order_item.rb', line 28 def initialize(item_id) @item_id = item_id end |
Instance Attribute Details
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
26 27 28 |
# File 'lib/emaildirect/order_item.rb', line 26 def item_id @item_id end |
Class Method Details
.all(options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/emaildirect/order_item.rb', line 8 def all( = {}) response = EmailDirect.get '/Orders/Items', :query => Hashie::Mash.new(response) end |
.create(email, options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/emaildirect/order_item.rb', line 13 def create(email, = {}) .merge! :EmailAddress => email response = EmailDirect.post '/Orders', :body => .to_json Hashie::Mash.new(response) end |
.import(orders) ⇒ Object
19 20 21 22 23 |
# File 'lib/emaildirect/order_item.rb', line 19 def import(orders) = { :Orders => Array(orders) } response = EmailDirect.post '/Orders/Import', :body => .to_json Hashie::Mash.new(response) end |
Instance Method Details
#delete ⇒ Object
43 44 45 |
# File 'lib/emaildirect/order_item.rb', line 43 def delete response = EmailDirect.delete uri_for, {} end |
#details ⇒ Object
32 33 34 35 |
# File 'lib/emaildirect/order_item.rb', line 32 def details response = get Hashie::Mash.new(response) end |
#update(email, options) ⇒ Object
37 38 39 40 41 |
# File 'lib/emaildirect/order_item.rb', line 37 def update(email, ) .merge! :EmailAddress => email response = EmailDirect.put uri_for, :body => .to_json Hashie::Mash.new(response) end |