godaddy-api 0.1.0 → 0.1.1

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: a230ee5884e149472081252edc4d4005e7caab27
4
- data.tar.gz: 8973b6bef7d05de77aa07653fce6c43a4e6fbf76
3
+ metadata.gz: f1fc4fa20b7957b99b4500caaec0906e3a33de8d
4
+ data.tar.gz: 70a6f687c6971ca5efc0f040b071c2e4b313ce55
5
5
  SHA512:
6
- metadata.gz: 4a0d87b41923c36879fd841070e65c3388d41429e9a2cdaca893671957fae9f2346c4d5878470568e8f3c17860ccdbb97a623ce25aa3040418d595be5eeb85b5
7
- data.tar.gz: e3b6367fa7befe6e3bfb7a128eecee552d5582cc429de1e29bd381b56b774c8b172e6289efb60e96dd58e0d55920ef41dc7816074e9e87cd4269e890f69a4192
6
+ metadata.gz: 3b5c59ca2102c1d0cc400ec60a041e9a2c74d4d0303a9e157d4422fcee0076c11d42d54a3fa0cb9ecc2c93999c63cbe5dfdf7dcdd2f3c4ede530d3fc2b1d3fd3
7
+ data.tar.gz: 4fe385aa8229a74f5a589eabf5ce010ea5979012f83f77355d947c9c3c403d669bdf50e42f2b111553749cce36b9a2a9801c8e7d15c7e330d2887e3c116c7408
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # godaddy-api
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/godaddy-api.svg)](http://badge.fury.io/rb/godaddy-api)
3
4
  [![Dependency Status](https://gemnasium.com/blueicefield/ruby-godaddy-api.svg)](https://gemnasium.com/blueicefield/ruby-godaddy-api)
4
5
  [![Code Climate](https://codeclimate.com/github/blueicefield/ruby-godaddy-api/badges/gpa.svg)](https://codeclimate.com/github/blueicefield/ruby-godaddy-api)
5
6
 
@@ -32,6 +33,9 @@ require 'godaddy/api'
32
33
 
33
34
  api = Godaddy::Api.new apikey, apisecret
34
35
 
36
+ # To use the OTE endpoint, specify them as the 3rd argument
37
+ # api = Godaddy::Api.new apikey, apisecret, "https://api.ote-godaddy.com/"
38
+
35
39
  result = api.get('/v1/domains')
36
40
 
37
41
  puts result
@@ -62,6 +66,10 @@ puts result
62
66
  {}
63
67
  ```
64
68
 
69
+ ## ToDo
70
+
71
+ - Write tests.
72
+
65
73
  ## Development
66
74
 
67
75
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -76,4 +84,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/blueic
76
84
  ## License
77
85
 
78
86
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
79
-
data/godaddy-api.gemspec CHANGED
@@ -4,13 +4,13 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "godaddy-api"
7
- spec.version = "0.1.0"
7
+ spec.version = "0.1.1"
8
8
  spec.authors = ["Nassim Kacha"]
9
- spec.email = ["nassim.kacha@blueicefield.com"]
9
+ spec.email = ["nassim.kacha@gmail.com"]
10
10
 
11
11
  spec.summary = "A very minimalist library to interact with the GoDaddy API."
12
12
  spec.description = spec.summary
13
- spec.homepage = "https://github.com/blueicefield/ruby-godaddy-api"
13
+ spec.homepage = "https://github.com/nasskach/ruby-godaddy-api"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
data/lib/godaddy/api.rb CHANGED
@@ -5,9 +5,8 @@ module Godaddy
5
5
  class APIError < StandardError; end
6
6
 
7
7
  class Api
8
- API_URL = 'https://api.godaddy.com'
9
-
10
- def initialize(apikey, apisecret)
8
+ def initialize(apikey, apisecret, api_url = "https://api.godaddy.com")
9
+ @api_url = api_endpoint
11
10
  @headers = {
12
11
  'Authorization' => "sso-key #{apikey}:#{apisecret}",
13
12
  'Content-type' => 'application/json'
@@ -16,12 +15,16 @@ module Godaddy
16
15
 
17
16
  [:get, :post, :put, :patch, :delete].each do |method|
18
17
  define_method method do |uri, payload = nil|
19
- uri = URI(API_URL + uri)
18
+ uri = URI(@api_url + uri)
20
19
  http = Net::HTTP.new(uri.host, uri.port)
21
20
  http.use_ssl = true
22
21
  request = build_request method, uri, payload
23
22
  response = http.request(request)
24
- result = JSON.parse(response.body)
23
+ begin
24
+ result = JSON.parse(response.body)
25
+ rescue
26
+ result = response.body
27
+ end
25
28
 
26
29
  fail APIError, result unless response.is_a?(Net::HTTPSuccess)
27
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: godaddy-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nassim Kacha
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2019-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '10.0'
41
41
  description: A very minimalist library to interact with the GoDaddy API.
42
42
  email:
43
- - nassim.kacha@blueicefield.com
43
+ - nassim.kacha@gmail.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
@@ -56,7 +56,7 @@ files:
56
56
  - bin/setup
57
57
  - godaddy-api.gemspec
58
58
  - lib/godaddy/api.rb
59
- homepage: https://github.com/blueicefield/ruby-godaddy-api
59
+ homepage: https://github.com/nasskach/ruby-godaddy-api
60
60
  licenses:
61
61
  - MIT
62
62
  metadata: {}
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.4.5
79
+ rubygems_version: 2.5.2.3
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: A very minimalist library to interact with the GoDaddy API.