dnsimple-ruby 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -0,0 +1,131 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dnsimple-ruby}
8
+ s.version = "0.9.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Anthony Eden"]
12
+ s.date = %q{2011-02-20}
13
+ s.default_executable = %q{dnsimple}
14
+ s.description = %q{A ruby wrapper for the DNSimple API that also includes a command-line client.}
15
+ s.email = %q{anthony.eden@dnsimple.com}
16
+ s.executables = ["dnsimple"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README",
20
+ "README.rdoc",
21
+ "README.textile"
22
+ ]
23
+ s.files = [
24
+ ".bundle/config",
25
+ ".rvmrc",
26
+ "Gemfile",
27
+ "Gemfile.lock",
28
+ "LICENSE",
29
+ "README",
30
+ "README.rdoc",
31
+ "README.textile",
32
+ "Rakefile",
33
+ "VERSION",
34
+ "bin/dnsimple",
35
+ "bin/dnsimple.rb",
36
+ "lib/dnsimple.rb",
37
+ "lib/dnsimple/cli.rb",
38
+ "lib/dnsimple/client.rb",
39
+ "lib/dnsimple/commands/add_service.rb",
40
+ "lib/dnsimple/commands/add_template_record.rb",
41
+ "lib/dnsimple/commands/apply_template.rb",
42
+ "lib/dnsimple/commands/check_domain.rb",
43
+ "lib/dnsimple/commands/clear_domain.rb",
44
+ "lib/dnsimple/commands/create_contact.rb",
45
+ "lib/dnsimple/commands/create_domain.rb",
46
+ "lib/dnsimple/commands/create_record.rb",
47
+ "lib/dnsimple/commands/create_template.rb",
48
+ "lib/dnsimple/commands/delete_contact.rb",
49
+ "lib/dnsimple/commands/delete_domain.rb",
50
+ "lib/dnsimple/commands/delete_record.rb",
51
+ "lib/dnsimple/commands/delete_template.rb",
52
+ "lib/dnsimple/commands/delete_template_record.rb",
53
+ "lib/dnsimple/commands/describe_contact.rb",
54
+ "lib/dnsimple/commands/describe_domain.rb",
55
+ "lib/dnsimple/commands/describe_record.rb",
56
+ "lib/dnsimple/commands/describe_service.rb",
57
+ "lib/dnsimple/commands/describe_user.rb",
58
+ "lib/dnsimple/commands/list_applied_services.rb",
59
+ "lib/dnsimple/commands/list_available_services.rb",
60
+ "lib/dnsimple/commands/list_contacts.rb",
61
+ "lib/dnsimple/commands/list_domains.rb",
62
+ "lib/dnsimple/commands/list_extended_attributes.rb",
63
+ "lib/dnsimple/commands/list_records.rb",
64
+ "lib/dnsimple/commands/list_services.rb",
65
+ "lib/dnsimple/commands/list_template_records.rb",
66
+ "lib/dnsimple/commands/list_templates.rb",
67
+ "lib/dnsimple/commands/register_domain.rb",
68
+ "lib/dnsimple/commands/remove_service.rb",
69
+ "lib/dnsimple/commands/transfer_domain.rb",
70
+ "lib/dnsimple/commands/update_contact.rb",
71
+ "lib/dnsimple/commands/update_record.rb",
72
+ "lib/dnsimple/contact.rb",
73
+ "lib/dnsimple/domain.rb",
74
+ "lib/dnsimple/error.rb",
75
+ "lib/dnsimple/extended_attribute.rb",
76
+ "lib/dnsimple/record.rb",
77
+ "lib/dnsimple/service.rb",
78
+ "lib/dnsimple/template.rb",
79
+ "lib/dnsimple/template_record.rb",
80
+ "lib/dnsimple/transfer_order.rb",
81
+ "lib/dnsimple/user.rb",
82
+ "spec/README",
83
+ "spec/contact_spec.rb",
84
+ "spec/domain_spec.rb",
85
+ "spec/record_spec.rb",
86
+ "spec/spec_helper.rb",
87
+ "spec/template_spec.rb",
88
+ "spec/user_spec.rb"
89
+ ]
90
+ s.homepage = %q{http://github.com/aetrion/dnsimple-ruby}
91
+ s.require_paths = ["lib"]
92
+ s.rubygems_version = %q{1.3.7}
93
+ s.summary = %q{A ruby wrapper for the DNSimple API}
94
+ s.test_files = [
95
+ "spec/contact_spec.rb",
96
+ "spec/domain_spec.rb",
97
+ "spec/record_spec.rb",
98
+ "spec/spec_helper.rb",
99
+ "spec/template_spec.rb",
100
+ "spec/user_spec.rb"
101
+ ]
102
+
103
+ if s.respond_to? :specification_version then
104
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
105
+ s.specification_version = 3
106
+
107
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
108
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
109
+ s.add_development_dependency(%q<rake>, [">= 0"])
110
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
111
+ s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
112
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
113
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
114
+ else
115
+ s.add_dependency(%q<httparty>, [">= 0"])
116
+ s.add_dependency(%q<rake>, [">= 0"])
117
+ s.add_dependency(%q<jeweler>, [">= 0"])
118
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
119
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
120
+ s.add_dependency(%q<httparty>, [">= 0"])
121
+ end
122
+ else
123
+ s.add_dependency(%q<httparty>, [">= 0"])
124
+ s.add_dependency(%q<rake>, [">= 0"])
125
+ s.add_dependency(%q<jeweler>, [">= 0"])
126
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
127
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
128
+ s.add_dependency(%q<httparty>, [">= 0"])
129
+ end
130
+ end
131
+
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'pp'
3
2
  require 'httparty'
4
3
 
@@ -43,5 +43,9 @@ module DNSimple
43
43
  self.password = credentials['password']
44
44
  "Credentials loaded from #{path}"
45
45
  end
46
+
47
+ def self.standard_options
48
+ {:basic_auth => credentials, :format => :json, :headers => {'Accept' => 'application/json'}}
49
+ end
46
50
  end
47
51
  end
@@ -29,17 +29,17 @@ module DNSimple #:nodoc:
29
29
  # Delete the domain from DNSimple. WARNING: this cannot
30
30
  # be undone.
31
31
  def delete(options={})
32
- options.merge!({:basic_auth => Client.credentials})
33
- self.class.delete("#{Client.base_uri}/domains/#{id}.json", options)
32
+ options.merge!(DNSimple::Client.standard_options)
33
+ self.class.delete("#{Client.base_uri}/domains/#{id}", options)
34
34
  end
35
35
  alias :destroy :delete
36
36
 
37
37
  # Apply the given named template to the domain. This will add
38
38
  # all of the records in the template to the domain.
39
39
  def apply(template, options={})
40
+ options.merge!(DNSimple::Client.standard_options)
40
41
  template = resolve_template(template)
41
- options.merge!({:basic_auth => Client.credentials})
42
- self.class.post("#{Client.base_uri}/domains/#{id}/templates/#{template.id}/apply.json", options)
42
+ self.class.post("#{Client.base_uri}/domains/#{id}/templates/#{template.id}/apply", options)
43
43
  end
44
44
 
45
45
  #:nodoc:
@@ -53,8 +53,8 @@ module DNSimple #:nodoc:
53
53
  end
54
54
 
55
55
  def applied_services(options={})
56
- options.merge!({:basic_auth => Client.credentials})
57
- response = self.class.get("#{Client.base_uri}/domains/#{id}/applied_services.json", options)
56
+ options.merge!(DNSimple::Client.standard_options)
57
+ response = self.class.get("#{Client.base_uri}/domains/#{id}/applied_services", options)
58
58
  pp response if Client.debug?
59
59
  case response.code
60
60
  when 200
@@ -67,8 +67,8 @@ module DNSimple #:nodoc:
67
67
  end
68
68
 
69
69
  def available_services(options={})
70
- options.merge!({:basic_auth => Client.credentials})
71
- response = self.class.get("#{Client.base_uri}/domains/#{id}/available_services.json", options)
70
+ options.merge!(DNSimple::Client.standard_options)
71
+ response = self.class.get("#{Client.base_uri}/domains/#{id}/available_services", options)
72
72
  pp response if Client.debug?
73
73
  case response.code
74
74
  when 200
@@ -81,9 +81,9 @@ module DNSimple #:nodoc:
81
81
  end
82
82
 
83
83
  def add_service(id_or_short_name, options={})
84
- options.merge!(:basic_auth => Client.credentials)
84
+ options.merge!(DNSimple::Client.standard_options)
85
85
  options.merge!(:body => {:service => {:id => id_or_short_name}})
86
- response = self.class.post("#{Client.base_uri}/domains/#{name}/applied_services.json", options)
86
+ response = self.class.post("#{Client.base_uri}/domains/#{name}/applied_services", options)
87
87
  pp response if Client.debug?
88
88
  case response.code
89
89
  when 200
@@ -96,8 +96,8 @@ module DNSimple #:nodoc:
96
96
  end
97
97
 
98
98
  def remove_service(id, options={})
99
- options.merge!(:basic_auth => Client.credentials)
100
- response = self.class.delete("#{Client.base_uri}/domains/#{name}/applied_services/#{id}.json", options)
99
+ options.merge!(DNSimple::Client.standard_options)
100
+ response = self.class.delete("#{Client.base_uri}/domains/#{name}/applied_services/#{id}", options)
101
101
  pp response if Client.debug?
102
102
  case response.code
103
103
  when 200
@@ -111,8 +111,8 @@ module DNSimple #:nodoc:
111
111
 
112
112
  # Check the availability of a name
113
113
  def self.check(name, options={})
114
- options.merge!(:basic_auth => Client.credentials)
115
- response = self.get("#{Client.base_uri}/domains/#{name}/check.json", options)
114
+ options.merge!(DNSimple::Client.standard_options)
115
+ response = self.get("#{Client.base_uri}/domains/#{name}/check", options)
116
116
  pp response if Client.debug?
117
117
  case response.code
118
118
  when 200
@@ -130,12 +130,12 @@ module DNSimple #:nodoc:
130
130
  # method returns a Domain instance if the name is created
131
131
  # and raises an error otherwise.
132
132
  def self.create(name, options={})
133
+ options.merge!(DNSimple::Client.standard_options)
134
+
133
135
  domain_hash = {:name => name}
134
-
135
136
  options.merge!({:body => {:domain => domain_hash}})
136
- options.merge!({:basic_auth => Client.credentials})
137
137
 
138
- response = self.post("#{Client.base_uri}/domains.json", options)
138
+ response = self.post("#{Client.base_uri}/domains", options)
139
139
 
140
140
  pp response if Client.debug?
141
141
 
@@ -150,20 +150,18 @@ module DNSimple #:nodoc:
150
150
  end
151
151
 
152
152
  def self.register(name, registrant={}, extended_attributes={}, options={})
153
- body = {:domain => {:name => name}}
153
+ options.merge!(DNSimple::Client.standard_options)
154
154
 
155
+ body = {:domain => {:name => name}}
155
156
  if registrant[:id]
156
157
  body[:domain][:registrant_id] = registrant[:id]
157
158
  else
158
159
  body.merge!(:contact => registrant)
159
160
  end
160
-
161
161
  body.merge!(:extended_attribute => extended_attributes)
162
-
163
162
  options.merge!({:body => body})
164
- options.merge!({:basic_auth => Client.credentials})
165
-
166
- response = self.post("#{Client.base_uri}/domain_registrations.json", options)
163
+
164
+ response = self.post("#{Client.base_uri}/domain_registrations", options)
167
165
 
168
166
  pp response if Client.debug?
169
167
 
@@ -180,8 +178,8 @@ module DNSimple #:nodoc:
180
178
  # Find a specific domain in the account either by the numeric ID
181
179
  # or by the fully-qualified domain name.
182
180
  def self.find(id_or_name, options={})
183
- options.merge!({:basic_auth => Client.credentials})
184
- response = self.get("#{Client.base_uri}/domains/#{id_or_name}.json", options)
181
+ options.merge!(DNSimple::Client.standard_options)
182
+ response = self.get("#{Client.base_uri}/domains/#{id_or_name}", options)
185
183
 
186
184
  pp response if Client.debug?
187
185
 
@@ -199,8 +197,8 @@ module DNSimple #:nodoc:
199
197
 
200
198
  # Get all domains for the account.
201
199
  def self.all(options={})
202
- options.merge!({:basic_auth => Client.credentials})
203
- response = self.get("#{Client.base_uri}/domains.json", options)
200
+ options.merge!(DNSimple::Client.standard_options)
201
+ response = self.get("#{Client.base_uri}/domains", options)
204
202
 
205
203
  pp response if Client.debug?
206
204
 
@@ -213,5 +211,6 @@ module DNSimple #:nodoc:
213
211
  raise RuntimeError, "Error: #{response.code}"
214
212
  end
215
213
  end
214
+
216
215
  end
217
216
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anthony Eden
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-19 00:00:00 +01:00
18
+ date: 2011-02-20 00:00:00 -05:00
19
19
  default_executable: dnsimple
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -128,6 +128,7 @@ files:
128
128
  - VERSION
129
129
  - bin/dnsimple
130
130
  - bin/dnsimple.rb
131
+ - dnsimple-ruby.gemspec
131
132
  - lib/dnsimple.rb
132
133
  - lib/dnsimple/cli.rb
133
134
  - lib/dnsimple/client.rb