lightrail_client 1.1.0 → 1.1.1
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/README.md +8 -8
- data/lib/lightrail_client/account.rb +3 -3
- data/lib/lightrail_client/validator.rb +1 -1
- data/lib/lightrail_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dbaba3d13f944d69361ec2012c24acbfb8b3432
|
4
|
+
data.tar.gz: d3dc0e3edcafe433cfdfadf6ae1319060f64b180
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 160e0bcd1435b4558d838112b1f850d9de5355ab878aba6243a7400aa9be169065021581a9af9d43de29b92871abc6d4df86eb6d3e86caa4890292e6b2e0f6ad
|
7
|
+
data.tar.gz: 60f9b319e5e760aa873353dce742c8ea82506a0279482b0000e2d7876e227a78a0cc659989c7b2609e9133852789bbf12ae47802d224581fcdccbb46ff554076
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Lightrail Client for Ruby
|
2
2
|
|
3
|
-
Lightrail is a modern platform for digital account credits, gift cards, promotions, and points (to learn more, visit [Lightrail](https://www.lightrail.com/)). This is a basic library for developers to easily connect with the Lightrail API using Ruby. If you are looking for specific use cases or other languages, check out the complete list of all [Lightrail libraries
|
3
|
+
Lightrail is a modern platform for digital account credits, gift cards, promotions, and points (to learn more, visit [Lightrail](https://www.lightrail.com/)). This is a basic library for developers to easily connect with the Lightrail API using Ruby. If you are looking for specific use cases or other languages, check out the complete list of all [Lightrail libraries](https://www.lightrail.com/docs/#client-libraries/client-libraries).
|
4
4
|
|
5
5
|
## Features
|
6
6
|
|
@@ -9,11 +9,11 @@ The following features are supported in this version:
|
|
9
9
|
- Account Credits: create, retrieve, charge, refund, balance-check, and fund.
|
10
10
|
- Gift Cards: charge, refund, balance-check, and fund.
|
11
11
|
|
12
|
-
Note that the Lightrail API supports many other features and we are working on covering them in this gem. For a complete list of Lightrail API features check out the [Lightrail API documentation](https://www.lightrail.com/docs/).
|
12
|
+
Note that the Lightrail API supports many other features and we are working on covering them in this gem. For a complete list of Lightrail API features check out the [Lightrail API documentation](https://www.lightrail.com/docs/reference/).
|
13
13
|
|
14
14
|
## Related Projects
|
15
15
|
|
16
|
-
Check out the full list of [Lightrail client libraries
|
16
|
+
Check out the full list of [Lightrail client libraries](https://www.lightrail.com/docs/#client-libraries/client-libraries).
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
@@ -27,14 +27,14 @@ Lightrail.api_key = "<your lightrail API key>"
|
|
27
27
|
|
28
28
|
### Use Case: Account Credits Powered by Lightrail
|
29
29
|
|
30
|
-
For a quick demonstration of implementing account credits using this library, see our [Accounts Quickstart](https://
|
30
|
+
For a quick demonstration of implementing account credits using this library, see our [Accounts Quickstart](https://www.lightrail.com/docs/#accounts/accounts).
|
31
31
|
|
32
32
|
|
33
33
|
### Use Case: Gift Cards
|
34
34
|
|
35
35
|
**Looking for Lightrail's Drop-In Gift Card Solution?**
|
36
36
|
|
37
|
-
Check out our [Drop-in Gift Card documentation](https://
|
37
|
+
Check out our [Drop-in Gift Card documentation](https://www.lightrail.com/docs/#drop-in-gift-cards/drop-in-gift-cards) to get started.
|
38
38
|
|
39
39
|
**Prefer to build it yourself?**
|
40
40
|
|
@@ -167,7 +167,7 @@ gift_charge = Lightrail::Code.charge({
|
|
167
167
|
}
|
168
168
|
```
|
169
169
|
|
170
|
-
**A note on idempotency:** All calls to create or act on transactions (refund, void, capture) can optionally take a `userSuppliedId` parameter. The `userSuppliedId` is a client-side identifier (unique string) which is used to ensure idempotency (for more details, see the [API documentation](https://www.lightrail.com/docs/)). If you do not provide a `userSuppliedId`, the gem will create one for you for any calls that require one.
|
170
|
+
**A note on idempotency:** All calls to create or act on transactions (refund, void, capture) can optionally take a `userSuppliedId` parameter. The `userSuppliedId` is a client-side identifier (unique string) which is used to ensure idempotency (for more details, see the [API documentation](https://www.lightrail.com/docs/reference/)). If you do not provide a `userSuppliedId`, the gem will create one for you for any calls that require one.
|
171
171
|
|
172
172
|
```ruby
|
173
173
|
gift_charge = Lightrail::Code.charge({
|
@@ -180,7 +180,7 @@ gift_charge = Lightrail::Code.charge({
|
|
180
180
|
|
181
181
|
Note that Lightrail does not support currency exchange and the currency provided to these methods must match the currency of the gift card.
|
182
182
|
|
183
|
-
For more details on the parameters that you can pass in for a charge request and the response that you will get back, see the [API documentation](https://www.lightrail.com/docs/).
|
183
|
+
For more details on the parameters that you can pass in for a charge request and the response that you will get back, see the [API documentation](https://www.lightrail.com/docs/reference/).
|
184
184
|
|
185
185
|
#### Authorize-Capture Flow
|
186
186
|
|
@@ -246,7 +246,7 @@ Lightrail::Transaction.refund(gift_charge)
|
|
246
246
|
}
|
247
247
|
```
|
248
248
|
|
249
|
-
Note that this does not necessarily mean that the refunded amount is available for a re-charge. In the edge case where the funds for the original charge came from a promotion which has now expired, refunding will return those funds back to the now-expired value store and therefore the value will not be available for re-charge. To learn more about using value stores for temporary promotions, see the [
|
249
|
+
Note that this does not necessarily mean that the refunded amount is available for a re-charge. In the edge case where the funds for the original charge came from a promotion which has now expired, refunding will return those funds back to the now-expired value store and therefore the value will not be available for re-charge. To learn more about using value stores for temporary promotions, see the [Promotions Quickstart](https://www.lightrail.com/docs/#promotions/promotions).
|
250
250
|
|
251
251
|
#### Funding a Gift Card
|
252
252
|
|
@@ -4,8 +4,8 @@ module Lightrail
|
|
4
4
|
validated_params = Lightrail::Validator.set_params_for_account_create!(account_params)
|
5
5
|
|
6
6
|
# Make sure contact exists first
|
7
|
-
contact_id = Lightrail::Validator.get_contact_id(
|
8
|
-
shopper_id = Lightrail::Validator.get_shopper_id(
|
7
|
+
contact_id = Lightrail::Validator.get_contact_id(validated_params)
|
8
|
+
shopper_id = Lightrail::Validator.get_shopper_id(validated_params)
|
9
9
|
|
10
10
|
if contact_id
|
11
11
|
contact = Lightrail::Contact.retrieve_by_contact_id(contact_id)
|
@@ -18,7 +18,7 @@ module Lightrail
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# If the contact already has an account in that currency, return it
|
21
|
-
account_card = Lightrail::Account.retrieve({contact_id: contact['contactId'], currency:
|
21
|
+
account_card = Lightrail::Account.retrieve({contact_id: contact['contactId'], currency: validated_params[:currency]})
|
22
22
|
return account_card['cardId'] if account_card
|
23
23
|
|
24
24
|
params_with_contact_id = validated_params.clone
|
@@ -166,7 +166,7 @@ module Lightrail
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def self.validate_shopper_id! (shopper_id)
|
169
|
-
return true if ((shopper_id.is_a? String) && ((/\A[A-Z0-9
|
169
|
+
return true if ((shopper_id.is_a? String) && ((/\A[A-Z0-9\-\@\.]+\z/i =~ shopper_id).is_a? Integer))
|
170
170
|
raise Lightrail::LightrailArgumentError.new("Invalid shopper_id: #{shopper_id.inspect}")
|
171
171
|
end
|
172
172
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightrail_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lightrail
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|