xolphin-api 1.5.0

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.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +28 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +169 -0
  9. data/Rakefile +12 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/examples/_credentials.rb +8 -0
  13. data/examples/certificate_cancel.rb +6 -0
  14. data/examples/certificate_reissue.rb +25 -0
  15. data/examples/certificate_renew.rb +22 -0
  16. data/examples/get_notes.rb +9 -0
  17. data/examples/request_create_ee.rb +29 -0
  18. data/examples/request_validation_call.rb +5 -0
  19. data/examples/requests_get.rb +7 -0
  20. data/examples/send_csa_email.rb +5 -0
  21. data/examples/send_note.rb +6 -0
  22. data/lib/xolphin/api.rb +32 -0
  23. data/lib/xolphin/api/certificate_requests/certificate_reissue.rb +47 -0
  24. data/lib/xolphin/api/certificate_requests/certificate_renew.rb +51 -0
  25. data/lib/xolphin/api/certificate_requests/create_certificate_request.rb +52 -0
  26. data/lib/xolphin/api/certificate_requests/create_ee_request.rb +33 -0
  27. data/lib/xolphin/api/client.rb +21 -0
  28. data/lib/xolphin/api/dcv_type.rb +9 -0
  29. data/lib/xolphin/api/endpoint/certificate.rb +59 -0
  30. data/lib/xolphin/api/endpoint/request.rb +86 -0
  31. data/lib/xolphin/api/endpoint/support.rb +47 -0
  32. data/lib/xolphin/api/format_type.rb +12 -0
  33. data/lib/xolphin/api/http.rb +67 -0
  34. data/lib/xolphin/api/product_type.rb +9 -0
  35. data/lib/xolphin/api/responses/base.rb +43 -0
  36. data/lib/xolphin/api/responses/certificate.rb +53 -0
  37. data/lib/xolphin/api/responses/certificates.rb +25 -0
  38. data/lib/xolphin/api/responses/csr_data.rb +43 -0
  39. data/lib/xolphin/api/responses/note.rb +37 -0
  40. data/lib/xolphin/api/responses/notes.rb +24 -0
  41. data/lib/xolphin/api/responses/product.rb +53 -0
  42. data/lib/xolphin/api/responses/product_price.rb +27 -0
  43. data/lib/xolphin/api/responses/products.rb +25 -0
  44. data/lib/xolphin/api/responses/request.rb +119 -0
  45. data/lib/xolphin/api/responses/request_ee.rb +29 -0
  46. data/lib/xolphin/api/responses/request_validation.rb +37 -0
  47. data/lib/xolphin/api/responses/request_validation_domain.rb +35 -0
  48. data/lib/xolphin/api/responses/requests.rb +25 -0
  49. data/lib/xolphin/api/version.rb +5 -0
  50. data/xolphin-api-0.1.0.gem +0 -0
  51. data/xolphin-api.gemspec +26 -0
  52. metadata +136 -0
@@ -0,0 +1,9 @@
1
+ module Xolphin
2
+ module Api
3
+ module ProductType
4
+ SINGLE = "SINGLE"
5
+ MULTI = "MULTI"
6
+ WILDCARD = "WILDCARD"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,43 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class Base
5
+ def initialize(data)
6
+ @data = data
7
+ end
8
+
9
+ def error?
10
+ errors || message
11
+ end
12
+
13
+ def errors
14
+ @data["errors"]
15
+ end
16
+
17
+ def message
18
+ @data["message"]
19
+ end
20
+
21
+ def page
22
+ @data["page"]
23
+ end
24
+
25
+ def pages
26
+ @data["pages"]
27
+ end
28
+
29
+ def limit
30
+ @data["limit"]
31
+ end
32
+
33
+ def total
34
+ @data["total"]
35
+ end
36
+
37
+ def _embedded
38
+ @data["_embedded"]
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,53 @@
1
+ require 'time'
2
+
3
+ module Xolphin
4
+ module Api
5
+ module Responses
6
+ class Certificate < Base
7
+ def initialize(data)
8
+ super(data)
9
+ end
10
+
11
+ def id
12
+ @data["id"]
13
+ end
14
+
15
+ def domain_name
16
+ @data["domainName"]
17
+ end
18
+
19
+ def subject_alternative_names
20
+ @data["subjectAlternativeNames"]
21
+ end
22
+
23
+ def date_issued
24
+ Time.parse(@data["dateIssued"])
25
+ end
26
+
27
+ def date_expired
28
+ Time.parse(@data["dateExpired"])
29
+ end
30
+
31
+ def company
32
+ @data["company"]
33
+ end
34
+
35
+ def customer_id
36
+ @data["customerId"]
37
+ end
38
+
39
+ def expired?
40
+ date_expired <= Time.now
41
+ end
42
+
43
+ def product
44
+ @product ||= begin
45
+ if _embedded && _embedded["product"]
46
+ Product.new(_embedded["product"])
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,25 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class Certificates < Base
5
+ def initialize(data)
6
+ super(data)
7
+ end
8
+
9
+ def certificates
10
+ @certificates ||= begin
11
+ certificates = []
12
+
13
+ if _embedded && _embedded["certificates"]
14
+ _embedded["certificates"].each do |certificate|
15
+ certificates << Certificate.new(certificate)
16
+ end
17
+ end
18
+
19
+ certificates
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class CsrData < Base
5
+ def initialize(data)
6
+ super(data)
7
+ end
8
+
9
+ def type
10
+ @data["type"]
11
+ end
12
+
13
+ def size
14
+ @data["size"]
15
+ end
16
+
17
+ def company
18
+ @data["company"]
19
+ end
20
+
21
+ def cn
22
+ @data["cn"]
23
+ end
24
+
25
+ def state
26
+ @data["state"]
27
+ end
28
+
29
+ def city
30
+ @data["city"]
31
+ end
32
+
33
+ def country
34
+ @data["country"]
35
+ end
36
+
37
+ def alt_names
38
+ @data["altNames"]
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,37 @@
1
+ require 'time'
2
+
3
+ module Xolphin
4
+ module Api
5
+ module Responses
6
+ class Note < Base
7
+ def initialize(data)
8
+ super(data)
9
+ end
10
+
11
+ def contact
12
+ @data["contact"]
13
+ end
14
+
15
+ def staff
16
+ @data["staff"]
17
+ end
18
+
19
+ def date
20
+ @data["date"]
21
+ end
22
+
23
+ def time
24
+ @data["time"]
25
+ end
26
+
27
+ def message_body
28
+ @data["message"]
29
+ end
30
+
31
+ def created_at
32
+ Time.parse(@data["createdAt"])
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class Notes < Base
5
+ def initialize(data)
6
+ super(data)
7
+ end
8
+
9
+ def notes
10
+ @notes ||= begin
11
+ notes = []
12
+ if _embedded && _embedded["notes"]
13
+ _embedded["notes"].each do |note|
14
+ notes << Note.new(note)
15
+ end
16
+ end
17
+ notes
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,53 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class Product < Base
5
+ def initialize(data)
6
+ super(data)
7
+ end
8
+
9
+ def prices
10
+ @prices ||= begin
11
+ prices = []
12
+
13
+ if @data["prices"]
14
+ @data["prices"].each do |price|
15
+ prices << ProductPrice.new(price)
16
+ end
17
+ end
18
+
19
+ prices
20
+ end
21
+ end
22
+
23
+ def id
24
+ @data["id"]
25
+ end
26
+
27
+ def brand
28
+ @data["brand"]
29
+ end
30
+
31
+ def name
32
+ @data["name"]
33
+ end
34
+
35
+ def type
36
+ @data["type"]
37
+ end
38
+
39
+ def validation
40
+ @data["validation"]
41
+ end
42
+
43
+ def included_domains
44
+ @data["includedDomains"]
45
+ end
46
+
47
+ def max_domains
48
+ @data["maxDomains"]
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,27 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class ProductPrice < Base
5
+ def initialize(data)
6
+ super(data)
7
+ end
8
+
9
+ def years
10
+ @data["years"]
11
+ end
12
+
13
+ def price
14
+ @data["price"]
15
+ end
16
+
17
+ def extra_price
18
+ @data["extraPrice"]
19
+ end
20
+
21
+ def extra_price_wildcard
22
+ @data["extraPriceWildcard"]
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ module Xolphin
2
+ module Api
3
+ module Responses
4
+ class Products < Base
5
+ def initialize(data)
6
+ super(data)
7
+ end
8
+
9
+ def products
10
+ @products ||= begin
11
+ products = []
12
+
13
+ if _embedded && _embedded["products"]
14
+ _embedded["products"].each do |product|
15
+ products << Product.new(product)
16
+ end
17
+ end
18
+
19
+ products
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,119 @@
1
+ require 'time'
2
+
3
+ module Xolphin
4
+ module Api
5
+ module Responses
6
+ class Request < Base
7
+ def initialize(data)
8
+ super(data)
9
+ end
10
+
11
+ def id
12
+ @data["id"]
13
+ end
14
+
15
+ def domain_name
16
+ @data["domainName"]
17
+ end
18
+
19
+ def company
20
+ @data["company"]
21
+ end
22
+
23
+ def date_ordered
24
+ Time.parse(@data["dateOrdered"])
25
+ end
26
+
27
+ def subject_alternative_names
28
+ @data["subjectAlternativeNames"]
29
+ end
30
+
31
+ def years
32
+ @data["years"]
33
+ end
34
+
35
+ def department
36
+ @data["department"]
37
+ end
38
+
39
+ def address
40
+ @data["address"]
41
+ end
42
+
43
+ def zipcode
44
+ @data["zipcode"]
45
+ end
46
+
47
+ def city
48
+ @data["city"]
49
+ end
50
+
51
+ def province
52
+ @data["province"]
53
+ end
54
+
55
+ def country
56
+ @data["country"]
57
+ end
58
+
59
+ def reference
60
+ @data["reference"]
61
+ end
62
+
63
+ def approver_first_name
64
+ @data["approverFirstName"]
65
+ end
66
+
67
+ def approver_last_name
68
+ @data["approverLastName"]
69
+ end
70
+
71
+ def approver_email
72
+ @data["approverEmail"]
73
+ end
74
+
75
+ def approver_phone
76
+ @data["approverPhone"]
77
+ end
78
+
79
+ def postbox
80
+ @data["postbox"]
81
+ end
82
+
83
+ def kvk
84
+ @data["kvk"]
85
+ end
86
+
87
+ def reqiures_action
88
+ @data["requiresAction"]
89
+ end
90
+
91
+ def brand_validation
92
+ @data["brandValidation"]
93
+ end
94
+
95
+ def validations
96
+ @validations ||= begin
97
+ validations = []
98
+
99
+ if @data["validations"]
100
+ @data["validations"].each do |validation|
101
+ validations << RequestValidation.new(validation)
102
+ end
103
+ end
104
+
105
+ validations
106
+ end
107
+ end
108
+
109
+ def product
110
+ @product ||= begin
111
+ if _embedded && _embedded["product"]
112
+ Product.new(_embedded["product"])
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end