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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9298a5e685b71c64e01090615b930d8130d5d9df
4
- data.tar.gz: 416cb541d62144520854512946c4903c153b0d72
3
+ metadata.gz: d146aef639183a82f7cc6a02604bbc538546a659
4
+ data.tar.gz: f96329bbb414eeac5944b4acd3f8cc1534321502
5
5
  SHA512:
6
- metadata.gz: b8d480b6c5795438355c07cf47e609bfc110b3cda2db5e043144af430e624acd40944838af6282f1eacca4f7fbb91f4323ca15c5a77c2d022e2f55608e0e9fbd
7
- data.tar.gz: 978ded6da0f1370f8072e3d8254a81a40936c79e6a889a88e63dd1fb673ae27e6e86221cccf63393a6431353b7c06142e7d63cf1590ed8b2d67291de25b7cb9c
6
+ metadata.gz: 8dccc11d1c801bb461dff16cfdbef555994f8bad23ac658f0fd1bf3ecd3d26c79966c121c4284af792ee9c0d85ddaf46475153f6af62f3ab13914a9f8d9ff402
7
+ data.tar.gz: 81691a589f742b0f6b40925e3629d1737228faf8c2cd26532393dbb6e7c4527a86c6da14be3b382ce96ed5b4f4395404a35b7723884db65ac40adf654c759bb0
@@ -7,7 +7,7 @@ class GiftRocket::Account
7
7
  @sender_name = nil
8
8
 
9
9
  def initialize(options = {})
10
- data = File.exists?(self.class.config_file) ? YAML.load_file(self.class.config_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
 
@@ -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.1
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: 2015-12-11 00:00:00.000000000 Z
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.4.8
73
+ rubygems_version: 2.5.1
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: GiftRocket Client