record_store 5.7.0 → 5.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dea515dfa1642780adedb1353bcae13ea6882092926a3c030623c67dbdff0bbe
4
- data.tar.gz: 888a2d16c617080fd4a25fc36c21d39f2920cc5c287d1e046e8e98831f70e05a
3
+ metadata.gz: 76a9b267be27d4f9f0f013f7bbfd4ea2b55f5e364bf720abd614244ae0943c04
4
+ data.tar.gz: d638f51c612e9e45aca478400ddd7f3b42d20bc4de0cf8575bd26efd6d8d9002
5
5
  SHA512:
6
- metadata.gz: 18fe6d29ec4be5a40659aadbab31c2111bf84a376a670862270b469a8e244689883980a6e4224156ebab11984d9a8f034b0d1dd0a7bcbbaac590044a6047e602
7
- data.tar.gz: d671eae01d176ed3da8ef298c32fdaafe42880798e47c0a41e93b018c1b26c01543b239bce26f57f042bfd07ea761d2c46ba098042efad605f1694a842fadce6
6
+ metadata.gz: aa98bccefee0aedecde5a2ea5582205fe8abdd4324220e76a3e728dfd43fef909be0e4561d828f6a41e91e908ea5d9f481fc8e1714d0adb80c3ffc38ef67f1ec
7
+ data.tar.gz: b2b8bde921e73d537a48edc9fc8f9ae731f2af91555b713ad565e5f4deb6e9b05d7d55cee3f9d8e9dffb1dc8ed70cfa5e000570186fffc9477fa4efb41985ec4
@@ -819,13 +819,13 @@ Layout/TrailingWhitespace:
819
819
  Style/UnlessElse:
820
820
  Enabled: true
821
821
 
822
- Style/UnneededCapitalW:
822
+ Style/RedundantCapitalW:
823
823
  Enabled: true
824
824
 
825
- Style/UnneededInterpolation:
825
+ Style/RedundantInterpolation:
826
826
  Enabled: true
827
827
 
828
- Style/UnneededPercentQ:
828
+ Style/RedundantPercentQ:
829
829
  Enabled: true
830
830
 
831
831
  Style/VariableInterpolation:
@@ -956,13 +956,13 @@ Lint/UnderscorePrefixedVariableName:
956
956
  Lint/UnifiedInteger:
957
957
  Enabled: true
958
958
 
959
- Lint/UnneededCopDisableDirective:
959
+ Lint/RedundantCopDisableDirective:
960
960
  Enabled: true
961
961
 
962
- Lint/UnneededCopEnableDirective:
962
+ Lint/RedundantCopEnableDirective:
963
963
  Enabled: true
964
964
 
965
- Lint/UnneededSplatExpansion:
965
+ Lint/RedundantSplatExpansion:
966
966
  Enabled: true
967
967
 
968
968
  Lint/UnreachableCode:
@@ -1,4 +1,7 @@
1
1
  # CHANGELOG
2
+ ## 5.7.1
3
+ - add API rate limit for NS1 provider [FEATURE]
4
+
2
5
  ## 5.7.0
3
6
  - add OCI library as runtime dependency [FEATURE]
4
7
 
data/README.md CHANGED
@@ -53,6 +53,42 @@ In addition, the `AliasService` permission is required to be able to read or wri
53
53
 
54
54
  For a breakdown of what each permission allows read through [DynECT's permissions guide](https://help.dyn.com/user-and-group-permissions/).
55
55
 
56
+ ### Google Cloud DNS
57
+
58
+ In order to use Google Cloud DNS, you'll need to add the `Service Account Credentials` to `secrets.json`. The `Service Account Credentials` is a JSON format file that you need to generate on Google Cloud Platform. You can find more details about the authentication from [here](https://googleapis.dev/ruby/google-cloud-dns/latest/file.AUTHENTICATION.html).
59
+
60
+ Here's an example of the JSON format file. You can simply copy all information and paste to `secrets.json` under the key, `google_cloud_dns`.
61
+ ```json
62
+ {
63
+ "type": "service_account",
64
+ "project_id": "[PROJECT-ID]",
65
+ "private_key_id": "[KEY-ID]",
66
+ "private_key": "-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----\n",
67
+ "client_email": "[SERVICE-ACCOUNT-EMAIL]",
68
+ "client_id": "[CLIENT-ID]",
69
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
70
+ "token_uri": "https://accounts.google.com/o/oauth2/token",
71
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
72
+ "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[SERVICE-ACCOUNT-EMAIL]"
73
+ }
74
+ ```
75
+
76
+ ### NS1
77
+
78
+ To use NS1, you'll need the API key generated from `Account Settings` on NS1 website. Add the generated API to the value of the `api_key` key of the `ns1` object in `secrets.json`.
79
+
80
+ ### Oracle Cloud Infrastructure
81
+
82
+ In order to use OCI, you'll need to add the `compartment_id`, `user`, `fingerprint`, `key_content`, `tenancy`, and `region` keys to `secrets.json`.
83
+
84
+ To find the `compartment_id`, the value you need is available in the `Compartment Details`, that you can find by following the `Identity` menu on the website, and selecting the `Compartments` menu. The value you want starts with `ocid1.compartment.oci..` or `ocid1.tenancy.oci..`.
85
+
86
+ The `user` will be found in the `User Details`, that you can find by following the `Users` on the website, and selecting the `Identity` menu on the website, and the value starts with `ocid1.user.oc1..`.
87
+
88
+ Regarding the `fingerprint` and `key_content`, you'll need to generate an API Signing Key (key pair) by following [these steps](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm).
89
+
90
+ The `tenancy` and `region` are in the `Profile` menu. The `tenancy` starts with `ocid1.tenancy.oc1..`.
91
+
56
92
  ----
57
93
 
58
94
  # Architecture
@@ -131,14 +167,14 @@ class Provider
131
167
  #
132
168
  # Arguments:
133
169
  # record - a kind of `Record`
134
- def add(record)
170
+ def add(zone, record)
135
171
  end
136
172
 
137
173
  # Deletes an existing record from the zone. It is expected this call modifies external state.
138
174
  #
139
175
  # Arguments:
140
176
  # record - a kind of `Record`
141
- def remove(record)
177
+ def remove(zone, record)
142
178
  end
143
179
 
144
180
  # Updates an existing record in the zone. It is expected this call modifies external state.
@@ -146,7 +182,7 @@ class Provider
146
182
  # Arguments:
147
183
  # id - provider specific ID of record to update
148
184
  # record - a kind of `Record` which the record with `id` should be updated to
149
- def update(id, record)
185
+ def update(zone, id, record)
150
186
  end
151
187
  end
152
188
  ```
data/dev.yml CHANGED
@@ -2,7 +2,7 @@
2
2
  name: recordstore
3
3
 
4
4
  up:
5
- - ruby: 2.4.3
5
+ - ruby: 2.5.0
6
6
  - bundler
7
7
 
8
8
  commands:
@@ -1,4 +1,5 @@
1
1
  require_relative 'ns1/client'
2
+ require_relative 'ns1/patch_api_header'
2
3
 
3
4
  module RecordStore
4
5
  class Provider::NS1 < Provider
@@ -0,0 +1,21 @@
1
+ require 'net/http'
2
+
3
+ # Patch the method which retrieves headers for API rate limit dynamically
4
+ module NS1::Transport
5
+ class NetHttp
6
+ def process_response(response)
7
+ sleep(response.to_hash["x-ratelimit-period"].first.to_i /
8
+ [1, response.to_hash["x-ratelimit-remaining"].first.to_i].max.to_f)
9
+
10
+ body = JSON.parse(response.body)
11
+ case response
12
+ when Net::HTTPOK
13
+ NS1::Response::Success.new(body, response.code.to_i)
14
+ else
15
+ NS1::Response::Error.new(body, response.code.to_i)
16
+ end
17
+ rescue JSON::ParserError
18
+ raise NS1::Transport::ResponseParseError
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '5.7.0'.freeze
2
+ VERSION = '5.7.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: record_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.0
4
+ version: 5.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-22 00:00:00.000000000 Z
12
+ date: 2019-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -345,6 +345,7 @@ files:
345
345
  - lib/record_store/provider/google_cloud_dns.rb
346
346
  - lib/record_store/provider/ns1.rb
347
347
  - lib/record_store/provider/ns1/client.rb
348
+ - lib/record_store/provider/ns1/patch_api_header.rb
348
349
  - lib/record_store/provider/oracle_cloud_dns.rb
349
350
  - lib/record_store/record.rb
350
351
  - lib/record_store/record/a.rb