thesslstore 0.0.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32b2919df4191e02ad873fc55d32a54872d2bb89
4
- data.tar.gz: 6811a13f2fa9f1db9442a71ff381a935196a5ed1
3
+ metadata.gz: ac1a731ba0e47a7f67ae296bc592089f9d0d9fbb
4
+ data.tar.gz: d9db972418b75f31654ebc7e00d3fe3dfdf6eb57
5
5
  SHA512:
6
- metadata.gz: edecf567a3c5ef5ab68cbf286880186463a71b71a25bef50042a697469caa82096595254135e5c797481ee817841c7c4cc103a2dcf68bf6c679806621e4c8c9d
7
- data.tar.gz: de5f72388a79c138e6dc6bf209edb4c9368ba7c2bb8ddd28e85df8b394a235bf2dca3f0a361816938f00fb466347dd65892260d9c667d7401de4976568450736
6
+ metadata.gz: d762d4dd1b270f5051e7e5577151b248c336988efee3150ff326fb35ecb79d70bc60dde35a3999875ca339d44521e75b865ca635374787c1259ecfdb01cd9c66
7
+ data.tar.gz: bfbe7845bf9d58b405d7e02c0b6dde2d100c07e591e7112f662f1bde12a552e9b175d10924fa0905933f637ff0d9dba7367e9b21001ffa95a6a77598d376fae3
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Thesslstore
1
+ # TheSSLStore Gem
2
2
 
3
- TODO: Write a gem description
3
+ This gem will one day work, but currently this is just a placeholder.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ TODO
24
24
 
25
25
  ## Contributing
26
26
 
data/lib/thesslstore.rb CHANGED
@@ -1,5 +1,14 @@
1
1
  require "thesslstore/version"
2
+ require "thesslstore/client"
2
3
 
3
4
  module Thesslstore
4
- # Your code goes here...
5
+ CONFIG_PATH = File.expand_path("~/.thesslstore")
6
+
7
+ def self.config
8
+ @config ||= load_config
9
+ end
10
+
11
+ def self.load_config
12
+ File.exists?(Thesslstore::CONFIG_PATH) ? YAML.load_file(Thesslstore::CONFIG_PATH) : {}
13
+ end
5
14
  end
@@ -0,0 +1,25 @@
1
+ require 'virtus'
2
+ require 'active_support/json'
3
+
4
+ module Thesslstore
5
+ class Address
6
+ include Virtus.model
7
+
8
+ attribute :AddressLine1, String
9
+ attribute :AddressLine2, String
10
+ attribute :AddressLine3, String
11
+ attribute :City, String
12
+ attribute :Region, String
13
+ attribute :PostalCode, String
14
+ attribute :Country, String
15
+ attribute :Phone, String
16
+ attribute :Fax, String
17
+ attribute :LocalityName, String
18
+
19
+ def as_json(opts = nil)
20
+ hash = super
21
+ hash.reject! { |k,v| v.nil? }
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ require 'thesslstore/contact'
2
+
3
+ module Thesslstore
4
+ class AdminContact < Contact
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ require 'virtus'
2
+ require 'active_support/json'
3
+
4
+ module Thesslstore
5
+ class AuthRequest
6
+ include Virtus.model
7
+
8
+ attribute :PartnerCode, String
9
+ attribute :AuthToken, String
10
+ attribute :ReplayToken, String
11
+ attribute :UserAgent, String
12
+ attribute :Token, String
13
+ attribute :TokenID, String
14
+ attribute :TokenCode, String
15
+ attribute :IsUsedForTokenSystem, Boolean, :default => false
16
+
17
+ def Token=(token)
18
+ self.PartnerCode = nil
19
+ self.AuthToken = nil
20
+ self.IsUsedForTokenSystem = true
21
+ super token
22
+ end
23
+
24
+ def as_json(opts = nil)
25
+ hash = super
26
+ hash.reject! { |k,v| v.nil? }
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,37 @@
1
+ require "httparty"
2
+ require "thesslstore/order/new_order"
3
+ require "thesslstore/order/download"
4
+ require "thesslstore/order/query"
5
+ require "thesslstore/auth_request"
6
+
7
+ module Thesslstore
8
+ class Client
9
+ include HTTParty
10
+ format :json
11
+
12
+ attr_reader :auth_request
13
+
14
+ def initialize(options = {})
15
+ partner_code = options[:partner_code] || Thesslstore.config[:partner_code] || fail("Missing required options: :partner_code")
16
+ auth_token = options[:auth_token] || Thesslstore.config[:auth_token] || fail("Missing required options: :auth_token")
17
+ @auth_request = Thesslstore::AuthRequest.new({'PartnerCode' => partner_code, 'AuthToken' => auth_token})
18
+
19
+ self.class.base_uri('https://api.thesslstore.com/rest')
20
+ # Sets the headers for every request
21
+ self.class.headers({'Content-Type' => 'application/json; charset=utf-8', 'Accept' => 'application/json'})
22
+ end
23
+
24
+ def create_new_order(options = {})
25
+ new_order = Thesslstore::Order::NewOrder.new({AuthRequest: @auth_request})
26
+ end
27
+
28
+ def create_download(options = {})
29
+ download = Thesslstore::Order::Download.new({AuthRequest: @auth_request})
30
+ end
31
+
32
+ def create_query(options = {})
33
+ query = Thesslstore::Order::Query.new({AuthRequest: @auth_request})
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,28 @@
1
+ require 'virtus'
2
+ require 'active_support/json'
3
+
4
+ module Thesslstore
5
+ class Contact
6
+ include Virtus.model
7
+
8
+ attribute :FirstName, String
9
+ attribute :LastName, String
10
+ attribute :Phone, String
11
+ attribute :Fax, String
12
+ attribute :Email, String
13
+ attribute :Title, String
14
+ attribute :OrganizationName, String
15
+ attribute :AddressLine1, String
16
+ attribute :AddressLine2, String
17
+ attribute :City, String
18
+ attribute :Region, String
19
+ attribute :PostalCode, String
20
+ attribute :Country, String
21
+
22
+ def as_json(opts = nil)
23
+ hash = super
24
+ hash.reject! { |k,v| v.nil? }
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ require 'virtus'
2
+ require 'active_support/json'
3
+ require 'thesslstore/auth_request'
4
+
5
+ module Thesslstore
6
+ module Order
7
+ class Download
8
+ include Virtus.model
9
+
10
+ attribute :AuthRequest, Thesslstore::AuthRequest, :default => Thesslstore::AuthRequest.new
11
+ attribute :CustomOrderID, String
12
+ attribute :TheSSLStoreOrderID, String
13
+ attribute :ResendEmailType, String
14
+ attribute :ResendEmail, String
15
+ attribute :RefundReason, String
16
+ attribute :RefundRequestID, String
17
+ attribute :ApproverMethod, String
18
+ attribute :DomainNames, String
19
+ attribute :SerialNumber, String
20
+
21
+ def as_json(opts = nil)
22
+ hash = super
23
+ hash.reject! { |k,v| v.nil? }
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,53 @@
1
+ require 'virtus'
2
+ require 'active_support/json'
3
+ require 'thesslstore/auth_request'
4
+ require 'thesslstore/admin_contact'
5
+ require 'thesslstore/technical_contact'
6
+ require 'thesslstore/organisation_info'
7
+
8
+ module Thesslstore
9
+ module Order
10
+ class NewOrder
11
+ include Virtus.model
12
+
13
+ attribute :AuthRequest, Thesslstore::AuthRequest, :default => Thesslstore::AuthRequest.new
14
+ attribute :CustomOrderID, String, :default => "OR%s" % Time.new.to_i
15
+ attribute :ProductCode, String
16
+ attribute :ExtraProductCodes, String
17
+ attribute :OrganisationInfo, Thesslstore::OrganisationInfo, :default => Thesslstore::OrganisationInfo.new
18
+ attribute :ValidityPeriod, Integer, :default => 12
19
+ attribute :ServerCount, Integer, :default => 1
20
+ attribute :CSR, String
21
+ attribute :DomainName, String
22
+ attribute :WebServerType, String, :default => 'Other'
23
+ attribute :DNSNames, Array
24
+ attribute :isCUOrder, Boolean, :default => false
25
+ attribute :isRenewalOrder, Boolean, :default => false
26
+ attribute :SpecialInstructions, String
27
+ attribute :RelatedTheSSLStoreOrderID, String
28
+ attribute :isTrialOrder, Boolean, :default => false
29
+ attribute :AdminContact, Thesslstore::AdminContact, :default => Thesslstore::AdminContact.new
30
+ attribute :TechnicalContact, Thesslstore::TechnicalContact, :default => Thesslstore::TechnicalContact.new
31
+ attribute :ApproverEmail, String
32
+ attribute :ReserveSANCount, Integer, :default => 0
33
+ attribute :AddInstallationSupport, Boolean, :default => false
34
+ attribute :EmailLanguageCode, String, :default => "EN"
35
+ attribute :FileAuthDVIndicator, Boolean
36
+ attribute :CNAMEAuthDVIndicator, Boolean
37
+ attribute :SignatureHashAlgorithm, String, :default => "SHA2-256"
38
+
39
+
40
+ def as_json(opts = nil)
41
+ hash = super
42
+ hash.reject! do |k,v|
43
+ if Array === v
44
+ v.empty?
45
+ else
46
+ v.nil?
47
+ end
48
+ end
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,22 @@
1
+ require 'virtus'
2
+ require 'active_support/json'
3
+ require 'thesslstore/auth_request'
4
+
5
+ module Thesslstore
6
+ module Order
7
+ class Query
8
+ include Virtus.model
9
+
10
+ attribute :AuthRequest, Thesslstore::AuthRequest, :default => Thesslstore::AuthRequest.new
11
+ attribute :StartDate, String
12
+ attribute :EndDate, String
13
+ attribute :SubUserID, String
14
+ attribute :ProductCode, String
15
+
16
+ def as_json(opts = nil)
17
+ hash = super
18
+ hash.reject! { |k,v| v.nil? }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ require 'virtus'
2
+ require 'thesslstore/organization_address'
3
+
4
+ module Thesslstore
5
+ class OrganisationInfo
6
+ include Virtus.model
7
+
8
+ attribute :OrganizationName, String
9
+ attribute :DUNS, String
10
+ attribute :Division, String
11
+ attribute :IncorporatingAgency, String
12
+ attribute :RegistrationNumber, String
13
+ attribute :JurisdictionCity, String
14
+ attribute :JurisdictionRegion, String
15
+ attribute :JurisdictionCountry, String
16
+ attribute :OrganizationAddress, Thesslstore::OrganizationAddress, :default => Thesslstore::OrganizationAddress.new
17
+
18
+ def as_json(opts = nil)
19
+ hash = super
20
+ hash.reject! { |k,v| v.nil? }
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,6 @@
1
+ require 'thesslstore/address'
2
+
3
+ module Thesslstore
4
+ class OrganizationAddress < Address
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'thesslstore/contact'
2
+
3
+ module Thesslstore
4
+ class TechnicalContact < Contact
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Thesslstore
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/thesslstore.gemspec CHANGED
@@ -19,6 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.add_dependency "activesupport", "~> 4.0.4"
23
+ spec.add_dependency "virtus", "~> 1.0.1"
24
+
22
25
  spec.add_development_dependency "bundler", "~> 1.7"
23
26
  spec.add_development_dependency "rake", "~> 10.0"
24
27
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thesslstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Barnett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-13 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: virtus
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.1
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,6 +81,17 @@ files:
53
81
  - README.md
54
82
  - Rakefile
55
83
  - lib/thesslstore.rb
84
+ - lib/thesslstore/address.rb
85
+ - lib/thesslstore/admin_contact.rb
86
+ - lib/thesslstore/auth_request.rb
87
+ - lib/thesslstore/client.rb
88
+ - lib/thesslstore/contact.rb
89
+ - lib/thesslstore/order/download.rb
90
+ - lib/thesslstore/order/new_order.rb
91
+ - lib/thesslstore/order/query.rb
92
+ - lib/thesslstore/organisation_info.rb
93
+ - lib/thesslstore/organization_address.rb
94
+ - lib/thesslstore/technical_contact.rb
56
95
  - lib/thesslstore/version.rb
57
96
  - thesslstore.gemspec
58
97
  homepage: https://github.com/jasonwbarnett/thesslstore-gem
@@ -75,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
114
  version: '0'
76
115
  requirements: []
77
116
  rubyforge_project:
78
- rubygems_version: 2.4.1
117
+ rubygems_version: 2.4.3
79
118
  signing_key:
80
119
  specification_version: 4
81
120
  summary: thesslstore.com api wrapper in ruby