lightrail_client 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4b03b92b6056752123712d93bc1e574be852468
4
- data.tar.gz: 7bf40af48e0fdf721dc0507e8636ac392f200a33
3
+ metadata.gz: 0dbaba3d13f944d69361ec2012c24acbfb8b3432
4
+ data.tar.gz: d3dc0e3edcafe433cfdfadf6ae1319060f64b180
5
5
  SHA512:
6
- metadata.gz: 72a74728a92d19ae2236e7ded5ad73ba364351d7dcbe99e6baccf885413cb6b48ce5f875b4d26c458bef912fea4dd56dfb1fa86730daff7e6ed084028a803205
7
- data.tar.gz: 16874d6fb03e23c298996710ad3c0aa6a949f0a9b50d0ec77927a47f0e4725dec6adce72aad4aaca2bdf80b25d97435339c1aa14204422408b6e5d6285f49682
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 and integrations](https://github.com/Giftbit/Lightrail-API-Docs/blob/master/docs/client-libraries.md).
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 and integrations](https://github.com/Giftbit/Lightrail-API-Docs/blob/master/docs/client-libraries.md).
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://github.com/Giftbit/Lightrail-API-Docs/blob/master/docs/quickstart/accounts.md).
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://github.com/Giftbit/Lightrail-API-Docs/blob/master/docs/quickstart/drop-in-gift-cards.md#drop-in-gift-cards) to get started.
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 [Lightrail API docs](https://github.com/Giftbit/Lightrail-API-Docs/blob/master/use-cases/promotions.md).
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(account_params)
8
- shopper_id = Lightrail::Validator.get_shopper_id(account_params)
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: account_params[: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\-]+\z/i =~ shopper_id).is_a? Integer))
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
 
@@ -1,3 +1,3 @@
1
1
  module Lightrail
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
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.0
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-03-13 00:00:00.000000000 Z
11
+ date: 2018-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler