Class: GiftRocket
- Inherits:
-
Object
show all
- Defined in:
- lib/gift_rocket.rb
Defined Under Namespace
Modules: Error
Classes: Account, Gift, Recipient, Response
Class Method Summary
collapse
Class Method Details
.merge_params(*args) ⇒ Object
27
28
29
30
31
|
# File 'lib/gift_rocket.rb', line 27
def self.merge_params(*args)
query = {}
args.each{|x| query.merge!(x.params)}
return query.reject!{|k,v| v.nil?}
end
|
.quick_send(options) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/gift_rocket.rb', line 5
def self.quick_send(options)
g = GiftRocket::Gift.new(options)
a = GiftRocket::Account.new(options)
r = GiftRocket::Recipient.new(options)
send(g,a,r)
end
|
.send(gift, account, recipient) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/gift_rocket.rb', line 13
def self.send(gift, account, recipient)
options = {
:query => merge_params(gift, account, recipient)
}
response = HTTParty.post('https://www.giftrocket.com/gifts', options)
raise GiftRocket::Error::NetworkError.new(response) unless response.success?
return GiftRocket::Response.new(response.body)
end
|