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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzdkY2ExMWUxNzYyNGQ2Yzk3MDFjNjZiM2ZjZDhmYzI0YTlhMmIyOA==
4
+ Y2IxMWEyOTQ2YzYxNGI2ZDE5NmYxOTRhZmIwNDY0MTEyZjlkNTBkOQ==
5
5
  data.tar.gz: !binary |-
6
- ZjdmNmM3MjljYWNmZWE5Mjg0OThmYWFiNDY4NmIyM2VkYTFlNGY4ZQ==
6
+ YWVjMTMyMjQ0OGE1MDZhZTgzNWZiODNjMTFkZjcyZmZmYTQzMTQ2NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmEzYTY2NjZiOWIyNjIwMjY4OTA0YmJkZmIyOTU2NGI5ZTBhYWIxZTE0MDRj
10
- NDM0NjVhMjFlOWIzNmQxMjRiMGFlOTQ1YjQ3YmVmMWJmZjg3NGE1YmFlMDU5
11
- MzNlOWU3OGQ5NDEwM2RkYWQ0MDcwMmRkOGQ1NmNjZDE1NWI0ZDE=
9
+ YTBmN2YyYzNiOTdjMGY2YWY0NzIyY2NjYTI4MGUwY2E3ZGZkNTI4NWYxNTAx
10
+ MTg5ZDkzODZiYzkyYmU1NDBlNzg2MTkxZWNkMDBlYTFiNTY5MTMwN2Q2ZmRh
11
+ ODNjZjc4ZjljMzI5Yjk2ODUxZjQ2YTc2MjkzYjI0YzVjNmMyOTk=
12
12
  data.tar.gz: !binary |-
13
- YjYxNzk1MWRmMGEzM2IxMDY3NTJlZDg0YTFhZjE1NDcxOGNmYzc3YzkwODY3
14
- YWE3NjIyYTVmNzIyYzQ5ZGM2ZjgzNDZiOGM3NjE4Y2YwMzk3MThlNTc2OTA5
15
- M2Y5YTFkNDAzOTU3NWE4ZjZkM2VkOGQzMmRhMDM3OTYxNTE2MmY=
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 :certificate_path
15
- self.certificate_path = 'config/certificate.pem'
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::BULK_ENROLL_URL, data)
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::CHECK_TRANSACTION_URL, data)
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
- puts 'SHOW ORDER DETAILS'
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 = 'Password123'
30
- req.cert = @cert_path
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
@@ -1,3 +1,3 @@
1
1
  module Acc
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud MESUREUR