sports_south 0.11.0 → 0.12.0

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: 32664639ae431ea6c82263071e94099898aa6354
4
- data.tar.gz: ad995db38cc2181dee6b70f7b8b329fe16361292
3
+ metadata.gz: 76f6a22bed5beb8e75be417884d5fd436a8720e1
4
+ data.tar.gz: adc7a26cbf83092e7ad89861e600d83d58882971
5
5
  SHA512:
6
- metadata.gz: a45b73ace5a6ddfe6ccb705245f8e223effd3aa68570934493bddd0881f08b89c8a535bb2ab7fe5f361c013ed20f7696911629012b9447d5ceb4bcdba11e4d7a
7
- data.tar.gz: 7e5d7ca741db5db9359ed51eac322e7c33d40d8603ad4aacc3d75dbcf6c128d9123fd30cf4dcf5b32cc1169a739c2912289abf1a83ea1cacda8a8c72e64d680d
6
+ metadata.gz: b11ab187ea6c799df0ec70f0f39c8ce755ad6fad41f4c289c496fbbf48846076900677803684802d36c5f3b5ccf584ea893ed38381324b69f23665fb03ca0c87
7
+ data.tar.gz: 7f70b7403f3f7656c24bee341452f93fcd1714536b61f23906504bb53ab4b3c7df12a1221f1235242a5e5d7694794043f8e5b89f395f6c544bc98baadd7360da
@@ -0,0 +1,28 @@
1
+ module SportsSouth
2
+ class FFL < Base
3
+
4
+ API_URL = 'http://webservices.theshootingwarehouse.com/smart/orders.asmx'
5
+
6
+ DATE_REGEX = /\A\d+\/\d+\/\d+/
7
+
8
+ def self.accepts_transfer(ffl, options = {})
9
+ requires!(options, :username, :password, :source, :customer_number)
10
+
11
+ http, request = get_http_and_request(API_URL, '/FFLAcceptsTransfer')
12
+
13
+ request.set_form_data(form_params(options).merge({ FFL: ffl }))
14
+
15
+ response = http.request(request)
16
+ body = sanitize_response(response)
17
+ xml_doc = Nokogiri::XML(body)
18
+
19
+ raise SportsSouth::NotAuthenticated if not_authenticated?(xml_doc)
20
+
21
+ # Response returns FFL expiration date (does accept transfer),
22
+ # '0' if they do not accept transfer,
23
+ # or 'UNKNOWN' if SS cannot find the FFL.
24
+ xml_doc.content =~ DATE_REGEX ? true : false
25
+ end
26
+
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module SportsSouth
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
data/lib/sports_south.rb CHANGED
@@ -6,6 +6,7 @@ require 'nokogiri'
6
6
  require 'sports_south/base'
7
7
  require 'sports_south/brand'
8
8
  require 'sports_south/category'
9
+ require 'sports_south/ffl'
9
10
  require 'sports_south/image'
10
11
  require 'sports_south/inventory'
11
12
  require 'sports_south/invoice'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sports_south
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -88,6 +88,7 @@ files:
88
88
  - lib/sports_south/base.rb
89
89
  - lib/sports_south/brand.rb
90
90
  - lib/sports_south/category.rb
91
+ - lib/sports_south/ffl.rb
91
92
  - lib/sports_south/image.rb
92
93
  - lib/sports_south/inventory.rb
93
94
  - lib/sports_south/invoice.rb