cloud_party 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 57ef9d6c93a0f96357fe4dca2cfe036ed311aeeeea032b9442204a029bdc4151
4
- data.tar.gz: 7b57fa3be8d2409971f0b3ec5b6f094ef56de32bb441d6b9c3a722d2ac6b280d
3
+ metadata.gz: 57fa5791a1ef6bcc7a52dae9ba8717d46b2e18d990e827845be08107e7ed848f
4
+ data.tar.gz: 144340c2bd1bef54ef5cf7606d50718e0f068b1177cfe601e2b28860d9cfce24
5
5
  SHA512:
6
- metadata.gz: 3fb8036257d1dc17e518e4f2af61f975a04192274df707743b5cf8d9ce915bd5adbaaa69706257c1d0ca82df7e89c8df4f9b6ea9b01d8c56bac5256b6c3b1028
7
- data.tar.gz: 52fe56336f2f5260fe26ec3d34d6baf99a63ee46e16110700ab20c3f99fd31af6222f3d455097904a5c24dc3489bfa18f1c1866b08cc8e7fa04edd5b198192d1
6
+ metadata.gz: 004c8e19201510f10310974dc3311bebd21db74704a7dc500995c32bf7068decdeda160e12812936b17383888cf8a23925d3991052d38855458fee37de15b654
7
+ data.tar.gz: 1f752e39c576840a1ce8eba1da503be428fb4f1419af637eaa1b6ccd011eaa25f2945cf2e5b8aabc786dd7d35449d6faa483920fe2e9cbe6d8b44c47bd5c1d78
data/lib/cloud_party.rb CHANGED
@@ -35,9 +35,6 @@ module CloudParty
35
35
  class Connection
36
36
  include CloudParty::Context
37
37
  end
38
- def self.simple_connect
39
- CloudParty::Simple.new.connect
40
- end
41
38
  def self.context_connect
42
39
  Connection.new
43
40
  end
@@ -13,7 +13,21 @@ module CloudParty
13
13
  'Content-Type' => 'application/json',
14
14
  'User-Agent' => "CloudParty/#{CloudParty::VERSION}"
15
15
 
16
- def initialize(options = nil)
16
+ def self.set_id_by_name(zone)
17
+ options = {
18
+ match: 'all',
19
+ name: zone,
20
+ order: 'name'
21
+ }
22
+ if @options.nil?
23
+ @options = options
24
+ else
25
+ @options.merge!(options)
26
+ end
27
+
28
+ @@zone = CloudParty::Responses::Zones.new(:get, '/zones', get('/zones', query: @options), @options).result.first.fetch(:id, nil)
29
+ end
30
+ def initialize(options = {})
17
31
  super()
18
32
  @options = options
19
33
  end
@@ -25,6 +39,35 @@ module CloudParty
25
39
  def get(id)
26
40
  CloudParty::Responses::Zones.new(:get, '/zones/:id', self.class.get("/zones/#{id}"), @options)
27
41
  end
42
+
43
+ def add_record(type, name, content, opts, zone:)
44
+ zone_id = nil
45
+ options = {
46
+ type: type,
47
+ name: name,
48
+ content: content
49
+ }
50
+ ttl = opts.fetch('ttl', nil)
51
+ priority = opts.fetch('priority', nil)
52
+ proxied = opts.fetch('proxied', nil)
53
+ options.merge!(ttl: ttl) unless ttl.nil?
54
+ options.merge!(priority: priority) unless priority.nil?
55
+ options.merge!(proxied: proxied) unless proxied.nil?
56
+ if zone
57
+ zone_options = {
58
+ match: 'all',
59
+ name: zone,
60
+ order: 'name'
61
+ }
62
+ zone_id = CloudParty::Responses::Zones.new(:get, '/zones', get('/zones', query: zone_options), @options).result.first.fetch(:id, nil)
63
+ end
64
+
65
+ CloudParty::Responses::Zones.new(
66
+ :post,
67
+ '/zones/',
68
+ self.class.get("/zones/#{@@zone || zone_id}/dns_records", options),
69
+ @options)
70
+ end
28
71
  end
29
72
  end
30
73
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rubyflare'
4
3
  require 'app_configuration'
5
4
  module CloudParty
6
5
  class Simple
@@ -31,8 +30,5 @@ module CloudParty
31
30
  @api_key
32
31
  end
33
32
 
34
- def connect
35
- Rubyflare.connect_with(email, api_key)
36
- end
37
33
  end
38
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloudParty
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Spencer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-07 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler