enom-api 0.1.3 → 0.1.4

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{enom-api}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Geoff Garside"]
12
- s.date = %q{2011-03-31}
12
+ s.date = %q{2011-04-26}
13
13
  s.description = %q{Client for communicating with the eNom API}
14
14
  s.email = %q{geoff@geoffgarside.co.uk}
15
15
  s.extra_rdoc_files = [
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  ]
34
34
  s.homepage = %q{http://github.com/geoffgarside/enom-api}
35
35
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.6.2}
36
+ s.rubygems_version = %q{1.7.2}
37
37
  s.summary = %q{eNom API Client}
38
38
  s.test_files = [
39
39
  "test/helper.rb",
@@ -1,4 +1,5 @@
1
1
  require 'time'
2
+ require 'date'
2
3
  require 'demolisher'
3
4
 
4
5
  module EnomAPI
@@ -160,10 +161,18 @@ module EnomAPI
160
161
  # Get the expiration date of a domain
161
162
  #
162
163
  # @param [String] domain Domain name
163
- # @return [Time] expiration date of the domain
164
+ # @return [Time] expiration date of the domain in UTC
164
165
  def get_domain_exp(domain)
165
166
  xml = send_recv(:GetDomainExp, split_domain(domain))
166
- Time.parse(xml.ExpirationDate.strip)
167
+ fmt = "%m/%d/%Y %l:%M:%S %p %z"
168
+ str = "%s %s" % [xml.ExpirationDate.strip, xml.TimeDifference.strip]
169
+
170
+ if Time.respond_to?(:strptime)
171
+ Time.strptime(str, fmt).utc
172
+ else
173
+ dt = DateTime.strptime(str, fmt).new_offset(0) # UTC time
174
+ Time.utc(dt.year, dt.mon, dt.mday, dt.hour, dt.min, dt.sec + dt.sec_fraction)
175
+ end
167
176
  end
168
177
 
169
178
  # Get the domain information for a domain
@@ -680,7 +689,7 @@ module EnomAPI
680
689
  d['NS1'] = ''
681
690
  else
682
691
  nameservers.each_with_index do |n,i|
683
- d["NS#{i}"] = n
692
+ d["NS#{i+1}"] = n
684
693
  end
685
694
  end
686
695
  end
@@ -63,13 +63,14 @@ module EnomAPI
63
63
  "#{prefix}EmailAddress" => email,
64
64
  "#{prefix}Phone" => phone,
65
65
  "#{prefix}Fax" => fax }
66
- data["#{prefix}Address1"], data["#{prefix}Address2"] = address.split("\n", 2)
66
+ data["#{prefix}Address1"], data["#{prefix}Address2"] = address && address.split("\n", 2)
67
67
 
68
68
  unless organisation.nil? || organisation == ''
69
69
  data["#{prefix}OrganizationName"] = organisation
70
70
  data["#{prefix}JobTitle"] = (job_title || "Domains Manager")
71
71
  end
72
- data
72
+
73
+ data.reject { |_,v| v.nil? || v == '' }
73
74
  end
74
75
  private
75
76
  def self.from_xml_mapping_one
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enom-api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Geoff Garside
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-31 00:00:00 +01:00
19
- default_executable:
18
+ date: 2011-04-26 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: thoughtbot-shoulda
@@ -85,7 +84,6 @@ files:
85
84
  - lib/enom-api/search_query.rb
86
85
  - test/helper.rb
87
86
  - test/test_enom-api.rb
88
- has_rdoc: true
89
87
  homepage: http://github.com/geoffgarside/enom-api
90
88
  licenses: []
91
89
 
@@ -115,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
113
  requirements: []
116
114
 
117
115
  rubyforge_project:
118
- rubygems_version: 1.6.2
116
+ rubygems_version: 1.7.2
119
117
  signing_key:
120
118
  specification_version: 3
121
119
  summary: eNom API Client