acc 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/acc.rb +2 -2
- data/lib/acc/service.rb +5 -11
- data/lib/acc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2IxMWEyOTQ2YzYxNGI2ZDE5NmYxOTRhZmIwNDY0MTEyZjlkNTBkOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWVjMTMyMjQ0OGE1MDZhZTgzNWZiODNjMTFkZjcyZmZmYTQzMTQ2NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTBmN2YyYzNiOTdjMGY2YWY0NzIyY2NjYTI4MGUwY2E3ZGZkNTI4NWYxNTAx
|
10
|
+
MTg5ZDkzODZiYzkyYmU1NDBlNzg2MTkxZWNkMDBlYTFiNTY5MTMwN2Q2ZmRh
|
11
|
+
ODNjZjc4ZjljMzI5Yjk2ODUxZjQ2YTc2MjkzYjI0YzVjNmMyOTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjkxNjU3Yzg5ZmZiZGZmOGVhZmNmNzNmYWUzZDk4ZTQ3MjM4OTI3MTgwMDY2
|
14
|
+
OWNmNTc0NTMwYzdiYzM0YjExYjkxNzk5NmE4MzA4YzAyOWVkMjIzMTNjYjNk
|
15
|
+
OTNjYWExMWRhNmY2ZWE3ZDE4MjI2NDFhMTQxZTlmZmM4ZGQ2N2U=
|
data/lib/acc.rb
CHANGED
@@ -11,8 +11,8 @@ module Acc
|
|
11
11
|
mattr_accessor :show_order_endpoint
|
12
12
|
self.show_order_endpoint = 'https://api-applecareconnect-ept.apple.com/enroll-service/1.0/show-order-details'
|
13
13
|
|
14
|
-
mattr_accessor :
|
15
|
-
|
14
|
+
mattr_accessor :certificate
|
15
|
+
mattr_accessor :certificate_password
|
16
16
|
|
17
17
|
def self.setup
|
18
18
|
yield self
|
data/lib/acc/service.rb
CHANGED
@@ -1,24 +1,18 @@
|
|
1
1
|
require 'curb'
|
2
2
|
|
3
3
|
class Acc::Service
|
4
|
-
def initialize
|
5
|
-
@cert_path = File.join(Rails.root, Acc::CERTIFICATE_PATH)
|
6
|
-
raise 'Invalid path to certificate' unless File.file?(@cert_path)
|
7
|
-
end
|
8
|
-
|
9
4
|
def bulk_enroll data
|
10
|
-
http_resp = request(Acc
|
5
|
+
http_resp = request(Acc.bulk_enroll_endpoint, data)
|
11
6
|
Acc::BulkEnrollResponse.new JSON.parse(http_resp.body_str)
|
12
7
|
end
|
13
8
|
|
14
9
|
def check_transaction_status data
|
15
|
-
http_resp = request(Acc
|
10
|
+
http_resp = request(Acc.check_transaction_endpoint, data)
|
16
11
|
Acc::CheckTransactionResponse.new JSON.parse(http_resp.body_str)
|
17
12
|
end
|
18
13
|
|
19
14
|
def show_order_details data
|
20
|
-
|
21
|
-
http_resp = request(Acc::SHOW_ORDER_URL, data)
|
15
|
+
http_resp = request(Acc.show_order_endpoint, data)
|
22
16
|
puts http_resp
|
23
17
|
JSON.parse(http_resp.body_str)
|
24
18
|
end
|
@@ -26,8 +20,8 @@ class Acc::Service
|
|
26
20
|
private
|
27
21
|
def request url, data
|
28
22
|
http_response = Curl::Easy.perform(url) do |req|
|
29
|
-
req.certpassword =
|
30
|
-
req.cert =
|
23
|
+
req.certpassword = Acc.certificate_password
|
24
|
+
req.cert = Acc.certificate
|
31
25
|
req.post_body = data
|
32
26
|
req.headers['Content-Type'] = 'application/json'
|
33
27
|
end
|
data/lib/acc/version.rb
CHANGED