loopiator 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5affbb391d115c51aab353b0bc8d4875dd6195a6
4
+ data.tar.gz: f258c432f16ed2bac1c688becdabfba00bfec7ab
5
+ SHA512:
6
+ metadata.gz: b07dc2ad5815511e2a6febc3ba7a0521d62ce3cafd8cfefb3a0fc620269e484cb0d3a5e5387f7971e2cccdd8ce8227f8c36bcd213715abc8e0682bf5afc09826
7
+ data.tar.gz: f3af5648404af7d6132d45f8c912db20484feaa3d0475d656e6a40e7761f3e6c3cac0192a96ff7d3af021d2899e2c6f650c5e0f3dbe97786eea20d7901b3dfc9
data/Gemfile CHANGED
@@ -1,9 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- group :development, :test do
4
- gem 'rspec'
5
- gem "mocha"
6
- end
7
-
8
- gemspec
9
-
3
+ gemspec
@@ -75,5 +75,4 @@ module Loopiator
75
75
  include Loopiator::Domains
76
76
  include Loopiator::Credits
77
77
  end
78
- end
79
-
78
+ end
@@ -18,20 +18,23 @@ module Loopiator
18
18
  return domain
19
19
  end
20
20
 
21
- def add_domain_to_account(domain_name, should_buy = false, customer_number = "")
22
- response = parse_status_response(call("addDomainToAccount", customer_number, encode_domain(domain_name), should_buy))
21
+ def order_domain(domain_name, accept_terms: true, customer_number: "", raise_exception_on_occupied: false)
22
+ response = parse_status_response(call("orderDomain", customer_number, encode_domain(domain_name), accept_terms))
23
+
24
+ raise Loopiator::DomainOccupiedError if (response.eql?(:domain_occupied) && raise_exception_on_occupied)
23
25
 
24
26
  return response.eql?(:ok)
25
27
  end
26
28
 
27
- def purchase_domain(domain_name, customer_number = "")
28
- success = false
29
+ def purchase_domain(domain_name, customer_number: "", raise_exception_on_occupied: false)
30
+ success = false
31
+ ordered = order_domain(domain_name, accept_terms: true, customer_number: customer_number, raise_exception_on_occupied: raise_exception_on_occupied)
29
32
 
30
- if (add_domain_to_account(domain_name, true, customer_number))
31
- domain = get_domain(domain_name, customer_number)
33
+ if (ordered)
34
+ domain = get_domain(domain_name, customer_number)
32
35
 
33
- if (domain && domain.needs_to_be_paid? && domain.reference_number != nil && domain.reference_number != "")
34
- success = pay_invoice_using_credits(domain.reference_number, customer_number)
36
+ if (domain && domain.needs_to_be_paid? && !domain.reference_number.nil? && !domain.reference_number.empty?)
37
+ success = pay_invoice_using_credits(domain.reference_number, customer_number)
35
38
  end
36
39
  end
37
40
 
@@ -30,4 +30,10 @@ module Loopiator
30
30
  "An unknown connection error occurred while trying to connect to the API."
31
31
  end
32
32
  end
33
- end
33
+
34
+ class DomainOccupiedError < ApiError
35
+ def message
36
+ "The domain is occupied."
37
+ end
38
+ end
39
+ end
data/lib/loopiator.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Loopiator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
 
4
4
  require File.join(File.dirname(__FILE__), 'loopiator/railtie') if defined?(Rails)
5
5
 
@@ -16,5 +16,4 @@ module Loopiator
16
16
  require File.join(File.dirname(__FILE__), 'loopiator/credits')
17
17
 
18
18
  require File.join(File.dirname(__FILE__), 'loopiator/client')
19
- end
20
-
19
+ end
data/loopiator.gemspec CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'loopiator'
6
- s.version = '0.1.0'
6
+ s.version = '0.2.0'
7
7
 
8
8
  s.homepage = "https://github.com/Agiley/Loopiator"
9
9
  s.email = "sebastian@agiley.se"
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loopiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sebastian Johnsson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: simpleidn
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.0.4
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.0.4
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: mocha
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Interface for communicating with Loopia's API
@@ -102,25 +93,24 @@ files:
102
93
  - spec/spec_helper.rb
103
94
  homepage: https://github.com/Agiley/Loopiator
104
95
  licenses: []
96
+ metadata: {}
105
97
  post_install_message:
106
98
  rdoc_options: []
107
99
  require_paths:
108
100
  - lib
109
101
  required_ruby_version: !ruby/object:Gem::Requirement
110
- none: false
111
102
  requirements:
112
- - - ! '>='
103
+ - - ">="
113
104
  - !ruby/object:Gem::Version
114
105
  version: '0'
115
106
  required_rubygems_version: !ruby/object:Gem::Requirement
116
- none: false
117
107
  requirements:
118
- - - ! '>='
108
+ - - ">="
119
109
  - !ruby/object:Gem::Version
120
110
  version: 1.3.5
121
111
  requirements: []
122
112
  rubyforge_project:
123
- rubygems_version: 1.8.24
113
+ rubygems_version: 2.4.5
124
114
  signing_key:
125
115
  specification_version: 2
126
116
  summary: Interface for communicating with Loopia's API