giftrocket 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gift_rocket/account.rb +2 -1
- data/lib/gift_rocket/exceptions.rb +6 -0
- data/lib/gift_rocket/gift.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d146aef639183a82f7cc6a02604bbc538546a659
|
4
|
+
data.tar.gz: f96329bbb414eeac5944b4acd3f8cc1534321502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dccc11d1c801bb461dff16cfdbef555994f8bad23ac658f0fd1bf3ecd3d26c79966c121c4284af792ee9c0d85ddaf46475153f6af62f3ab13914a9f8d9ff402
|
7
|
+
data.tar.gz: 81691a589f742b0f6b40925e3629d1737228faf8c2cd26532393dbb6e7c4527a86c6da14be3b382ce96ed5b4f4395404a35b7723884db65ac40adf654c759bb0
|
data/lib/gift_rocket/account.rb
CHANGED
@@ -7,7 +7,7 @@ class GiftRocket::Account
|
|
7
7
|
@sender_name = nil
|
8
8
|
|
9
9
|
def initialize(options = {})
|
10
|
-
data = File.
|
10
|
+
data = File.exist?(self.class.config_file) ? YAML.load_file(self.class.config_file) : {}
|
11
11
|
|
12
12
|
@api_key = options[:api_key] || ENV['GIFT_ROCKET_API_KEY'] || data['api_key']
|
13
13
|
@payment_source = options[:payment_source] || data['payment_source'] || 'card'
|
@@ -15,6 +15,7 @@ class GiftRocket::Account
|
|
15
15
|
|
16
16
|
raise GiftRocket::Error::MissingApiKey.new('api_key not specified') if @api_key.nil?
|
17
17
|
raise GiftRocket::Error::MissingSenderName.new('sender_name not specified') if (@sender_name.nil? || @sender_name.empty?)
|
18
|
+
raise GiftRocket::Error::InvalidPaymentSource.new('payment_source is not valid') unless ['card','ach','invoice'].include?(@payment_source)
|
18
19
|
end
|
19
20
|
|
20
21
|
def send(gift, recipient)
|
@@ -3,6 +3,9 @@ module GiftRocket::Error
|
|
3
3
|
class MissingApiKey < ArgumentError
|
4
4
|
end
|
5
5
|
|
6
|
+
class InvalidPaymentSource < ArgumentError
|
7
|
+
end
|
8
|
+
|
6
9
|
class InvalidAmount < ArgumentError
|
7
10
|
end
|
8
11
|
|
@@ -12,6 +15,9 @@ module GiftRocket::Error
|
|
12
15
|
class MissingRecipientName < ArgumentError
|
13
16
|
end
|
14
17
|
|
18
|
+
class MissingMessage < ArgumentError
|
19
|
+
end
|
20
|
+
|
15
21
|
class MissingSenderName < ArgumentError
|
16
22
|
end
|
17
23
|
|
data/lib/gift_rocket/gift.rb
CHANGED
@@ -9,11 +9,12 @@ class GiftRocket::Gift
|
|
9
9
|
|
10
10
|
def initialize(options)
|
11
11
|
@amount = options[:amount]
|
12
|
-
@message_announce = options[:message_announce]
|
12
|
+
@message_announce = options[:message_announce] || options[:message]
|
13
13
|
@yelp_business_id = options[:yelp_business_id]
|
14
14
|
@test_gift = options[:test_gift]
|
15
15
|
|
16
16
|
raise GiftRocket::Error::InvalidAmount.new('Gift Amount not specified') unless (@amount||0) > 0
|
17
|
+
raise GiftRocket::Error::MissingMessage.new('Message not specified') if @message_announce.nil? || @message_announce.empty?
|
17
18
|
end
|
18
19
|
|
19
20
|
def params
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giftrocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessio Signorini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.5.1
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: GiftRocket Client
|