opensrs 0.3.4 → 0.4.0

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
- SHA1:
3
- metadata.gz: 127ecdac1c36fe084303d59efca748da537ce37a
4
- data.tar.gz: f4018a9dd533a217dcc80f6692e642f28d38cd4d
2
+ SHA256:
3
+ metadata.gz: 71d1e83d17bb3fbcf14fe9da34120322c4411bfeb37b9f6023806467025e5d5f
4
+ data.tar.gz: 941f1cc4275cf0f64635d6ed5e326a7ebdb9bc6ee98230c495de7e809637d661
5
5
  SHA512:
6
- metadata.gz: 9268aa3a9cca1924ca1b8e40257caaeb630cb3133dd78562ef734ca1e291e0467d4b927ecfac4f0c3698667b7d2772854796ff89f8a8b0c868a80c93d3a4d278
7
- data.tar.gz: e9b96abc301ff7a2f1101374847c44c3b1c5821351e5f7e7bd2fec9bfaaac2508fcb9177c6125b52ea8ca79261fca5ffc49341c483af38273346ad90b7fb872f
6
+ metadata.gz: df149b8fcd50164c419c51aa789d4dab1e8409952ec0b4b1f2fcd202948111512931d82a5169635b8690feec9f01d82fba0548b5952691dcf2d3323081b25210
7
+ data.tar.gz: 54e8f4bcbb4538d6215d94dd3bcd797f59dffa7e120a181b2af62d4f38c1cf8fb737d8298e516feda9f7bfc7b100b894714ea33cab4f8fc00458ab95b4b5c330
@@ -0,0 +1,43 @@
1
+ # pulled from repo
2
+ name: "Rubocop"
3
+
4
+ on:
5
+ push:
6
+ branches: [ master, rubocop ]
7
+ pull_request:
8
+ # The branches below must be a subset of the branches above
9
+ branches: [ master, rubocop ]
10
+ schedule:
11
+ - cron: '37 10 * * 2'
12
+
13
+ jobs:
14
+ rubocop:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+
19
+ steps:
20
+ - name: Checkout repository
21
+ uses: actions/checkout@v2
22
+
23
+ # If running on a self-hosted runner, check it meets the requirements
24
+ # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: 2.6
29
+
30
+ - name: Install dependencies
31
+ run: bundle install
32
+
33
+ - name: Rubocop run
34
+ run: |
35
+ bash -c "
36
+ bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
37
+ [[ $? -ne 2 ]]
38
+ "
39
+
40
+ - name: Upload Sarif output
41
+ uses: github/codeql-action/upload-sarif@v1
42
+ with:
43
+ sarif_file: rubocop.sarif
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.vscode
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ *.gem
16
+ mkmf.log
17
+ *.sarif
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format doc
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,131 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+ SuggestExtensions: false
6
+
7
+ Style/FrozenStringLiteralComment:
8
+ Enabled: false
9
+
10
+ RSpec/InstanceVariable:
11
+ Enabled: false
12
+
13
+ Metrics/BlockLength:
14
+ Enabled: false
15
+
16
+ RSpec/FilePath:
17
+ Enabled: false
18
+
19
+ Layout/LineLength:
20
+ Enabled: false
21
+
22
+ RSpec/MultipleExpectations:
23
+ Enabled: false
24
+
25
+ RSpec/ExampleLength:
26
+ Enabled: false
27
+
28
+ RSpec/NestedGroups:
29
+ Enabled: false
30
+
31
+ RSpec/MultipleMemoizedHelpers:
32
+ Enabled: false
33
+
34
+ RSpec/MessageSpies:
35
+ Enabled: false
36
+
37
+ RSpec/StubbedMock:
38
+ Enabled: false
39
+
40
+ RSpec/VerifiedDoubles:
41
+ Enabled: false
42
+
43
+ Metrics/MethodLength:
44
+ Enabled: false
45
+
46
+ Metrics/AbcSize:
47
+ Enabled: false
48
+
49
+ Style/ClassVars:
50
+ Enabled: false
51
+
52
+ Gemspec/DateAssignment: # (new in 1.10)
53
+ Enabled: true
54
+ Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
55
+ Enabled: true
56
+ Layout/SpaceBeforeBrackets: # (new in 1.7)
57
+ Enabled: true
58
+ Lint/AmbiguousAssignment: # (new in 1.7)
59
+ Enabled: true
60
+ Lint/AmbiguousRange: # (new in 1.19)
61
+ Enabled: true
62
+ Lint/DeprecatedConstants: # (new in 1.8)
63
+ Enabled: true
64
+ Lint/DuplicateBranch: # (new in 1.3)
65
+ Enabled: true
66
+ Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
67
+ Enabled: true
68
+ Lint/EmptyBlock: # (new in 1.1)
69
+ Enabled: true
70
+ Lint/EmptyClass: # (new in 1.3)
71
+ Enabled: true
72
+ Lint/EmptyInPattern: # (new in 1.16)
73
+ Enabled: true
74
+ Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
75
+ Enabled: true
76
+ Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
77
+ Enabled: true
78
+ Lint/NumberedParameterAssignment: # (new in 1.9)
79
+ Enabled: true
80
+ Lint/OrAssignmentToConstant: # (new in 1.9)
81
+ Enabled: true
82
+ Lint/RedundantDirGlobSort: # (new in 1.8)
83
+ Enabled: true
84
+ Lint/SymbolConversion: # (new in 1.9)
85
+ Enabled: true
86
+ Lint/ToEnumArguments: # (new in 1.1)
87
+ Enabled: true
88
+ Lint/TripleQuotes: # (new in 1.9)
89
+ Enabled: true
90
+ Lint/UnexpectedBlockArity: # (new in 1.5)
91
+ Enabled: true
92
+ Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
93
+ Enabled: true
94
+ Naming/InclusiveLanguage: # (new in 1.18)
95
+ Enabled: true
96
+ Style/ArgumentsForwarding: # (new in 1.1)
97
+ Enabled: true
98
+ Style/CollectionCompact: # (new in 1.2)
99
+ Enabled: true
100
+ Style/DocumentDynamicEvalDefinition: # (new in 1.1)
101
+ Enabled: true
102
+ Style/EndlessMethod: # (new in 1.8)
103
+ Enabled: true
104
+ Style/HashConversion: # (new in 1.10)
105
+ Enabled: true
106
+ Style/HashExcept: # (new in 1.7)
107
+ Enabled: true
108
+ Style/IfWithBooleanLiteralBranches: # (new in 1.9)
109
+ Enabled: true
110
+ Style/InPatternThen: # (new in 1.16)
111
+ Enabled: true
112
+ Style/MultilineInPatternThen: # (new in 1.16)
113
+ Enabled: true
114
+ Style/NegatedIfElseCondition: # (new in 1.2)
115
+ Enabled: true
116
+ Style/NilLambda: # (new in 1.3)
117
+ Enabled: true
118
+ Style/QuotedSymbols: # (new in 1.16)
119
+ Enabled: true
120
+ Style/RedundantArgument: # (new in 1.4)
121
+ Enabled: true
122
+ Style/RedundantSelfAssignmentBranch: # (new in 1.19)
123
+ Enabled: true
124
+ Style/StringChars: # (new in 1.12)
125
+ Enabled: true
126
+ Style/SwapValues: # (new in 1.1)
127
+ Enabled: true
128
+ RSpec/IdenticalEqualityAssertion: # (new in 2.4)
129
+ Enabled: true
130
+ RSpec/Rails/AvoidSetupHook: # (new in 2.4)
131
+ Enabled: true
data/Gemfile CHANGED
@@ -1,12 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "libxml-ruby", "~> 2.6.0"
4
-
5
- group :development do
6
- gem "nokogiri", "~> 1.4.6"
7
- gem "jeweler"
8
- gem "git"
9
- gem "rake"
10
- gem "shoulda"
11
- gem "rspec", "~> 2.0"
12
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,53 +1,99 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ opensrs (0.3.8)
5
+
1
6
  GEM
2
- remote: http://rubygems.org/
7
+ remote: https://rubygems.org/
3
8
  specs:
4
- activesupport (3.2.13)
5
- i18n (= 0.6.1)
6
- multi_json (~> 1.0)
7
- bourne (1.1.2)
8
- mocha (= 0.10.5)
9
- diff-lcs (1.2.1)
10
- git (1.2.5)
11
- i18n (0.6.1)
12
- jeweler (1.8.4)
13
- bundler (~> 1.0)
14
- git (>= 1.2.5)
15
- rake
16
- rdoc
17
- json (1.7.7)
18
- libxml-ruby (2.6.0)
19
- metaclass (0.0.1)
20
- mocha (0.10.5)
21
- metaclass (~> 0.0.1)
22
- multi_json (1.7.1)
23
- nokogiri (1.4.7)
24
- rake (10.0.3)
25
- rdoc (4.0.0)
26
- json (~> 1.4)
27
- rspec (2.13.0)
28
- rspec-core (~> 2.13.0)
29
- rspec-expectations (~> 2.13.0)
30
- rspec-mocks (~> 2.13.0)
31
- rspec-core (2.13.1)
32
- rspec-expectations (2.13.0)
33
- diff-lcs (>= 1.1.3, < 2.0)
34
- rspec-mocks (2.13.0)
35
- shoulda (3.3.2)
36
- shoulda-context (~> 1.0.1)
37
- shoulda-matchers (~> 1.4.1)
38
- shoulda-context (1.0.2)
39
- shoulda-matchers (1.4.2)
9
+ activesupport (4.2.10)
10
+ i18n (~> 0.7)
11
+ minitest (~> 5.1)
12
+ thread_safe (~> 0.3, >= 0.3.4)
13
+ tzinfo (~> 1.1)
14
+ ast (2.4.2)
15
+ code-scanning-rubocop (0.5.0)
16
+ rubocop (~> 1.0)
17
+ coderay (1.1.0)
18
+ concurrent-ruby (1.0.5)
19
+ diff-lcs (1.2.5)
20
+ i18n (0.9.3)
21
+ concurrent-ruby (~> 1.0)
22
+ libxml-ruby (3.2.1)
23
+ method_source (0.8.2)
24
+ mini_portile2 (2.5.1)
25
+ minitest (5.11.3)
26
+ nokogiri (1.11.4)
27
+ mini_portile2 (~> 2.5.0)
28
+ racc (~> 1.4)
29
+ parallel (1.20.1)
30
+ parser (3.0.2.0)
31
+ ast (~> 2.4.1)
32
+ pry (0.10.1)
33
+ coderay (~> 1.1.0)
34
+ method_source (~> 0.8.1)
35
+ slop (~> 3.4)
36
+ racc (1.5.2)
37
+ rainbow (3.0.0)
38
+ rake (13.0.6)
39
+ regexp_parser (2.1.1)
40
+ rexml (3.2.5)
41
+ rspec (3.2.0)
42
+ rspec-core (~> 3.2.0)
43
+ rspec-expectations (~> 3.2.0)
44
+ rspec-mocks (~> 3.2.0)
45
+ rspec-core (3.2.3)
46
+ rspec-support (~> 3.2.0)
47
+ rspec-expectations (3.2.1)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.2.0)
50
+ rspec-mocks (3.2.1)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.2.0)
53
+ rspec-support (3.2.2)
54
+ rubocop (1.19.0)
55
+ parallel (~> 1.10)
56
+ parser (>= 3.0.0.0)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ regexp_parser (>= 1.8, < 3.0)
59
+ rexml
60
+ rubocop-ast (>= 1.9.1, < 2.0)
61
+ ruby-progressbar (~> 1.7)
62
+ unicode-display_width (>= 1.4.0, < 3.0)
63
+ rubocop-ast (1.10.0)
64
+ parser (>= 3.0.1.1)
65
+ rubocop-rspec (2.4.0)
66
+ rubocop (~> 1.0)
67
+ rubocop-ast (>= 1.1.0)
68
+ ruby-progressbar (1.11.0)
69
+ shoulda (3.5.0)
70
+ shoulda-context (~> 1.0, >= 1.0.1)
71
+ shoulda-matchers (>= 1.4.1, < 3.0)
72
+ shoulda-context (1.2.1)
73
+ shoulda-matchers (2.8.0)
40
74
  activesupport (>= 3.0.0)
41
- bourne (~> 1.1.2)
75
+ slop (3.6.0)
76
+ thread_safe (0.3.6)
77
+ tzinfo (1.2.4)
78
+ thread_safe (~> 0.1)
79
+ unicode-display_width (2.0.0)
42
80
 
43
81
  PLATFORMS
44
82
  ruby
45
83
 
46
84
  DEPENDENCIES
47
- git
48
- jeweler
49
- libxml-ruby (~> 2.6.0)
50
- nokogiri (~> 1.4.6)
85
+ activesupport (~> 4.2.2)
86
+ bundler
87
+ code-scanning-rubocop (~> 0.5)
88
+ libxml-ruby (~> 3)
89
+ nokogiri (~> 1.11.4)
90
+ opensrs!
91
+ pry
51
92
  rake
52
- rspec (~> 2.0)
93
+ rspec
94
+ rubocop (~> 1)
95
+ rubocop-rspec
53
96
  shoulda
97
+
98
+ BUNDLED WITH
99
+ 1.17.2
@@ -1,4 +1,6 @@
1
- Copyright (c) 2010-2011 Josh Delsman
1
+ Copyright (c) 2014 Joshua Delsman
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # OpenSRS
2
+
3
+ [![Coverage Status](https://img.shields.io/coveralls/voxxit/opensrs.svg)](https://coveralls.io/r/voxxit/opensrs)
4
+
5
+ This unofficial OpenSRS gem provides basic support to connect to and utilize the [OpenSRS API.](http://www.opensrs.com/site/resources/documentation/api) This library has been well-tested in high-performance production
6
+ environments.
7
+
8
+ ### Requirements
9
+
10
+ * Ruby **>= 2.5**
11
+
12
+ ### Installation
13
+
14
+ You can install this gem by doing the following:
15
+
16
+ $ gem install opensrs
17
+
18
+ You can then include it in a Ruby project, like so:
19
+
20
+ require 'opensrs'
21
+
22
+ For Rails 3.x and above, add it to the `Gemfile`:
23
+
24
+ gem 'opensrs'
25
+ gem 'nokogiri' # if you want to use nokogiri as the XML parser
26
+ gem 'libxml-ruby' # if you want to use libxml as the XML parser
27
+
28
+ ### Usage
29
+
30
+ This library provides basic functionality for interacting with the OpenSRS XML API.
31
+
32
+ - Connection handling
33
+ - Error reporting
34
+ - XML encoding
35
+ - XML decoding
36
+
37
+ Currently, the library supports LibXML and Nokogiri as XML parsers. By default, it uses LibXML to parse and generate XML. If you'd like to use Nokogiri (1.4.7 and below) for parsing XML, then in one of your app initializers add the following line:
38
+
39
+ OpenSRS::Server.xml_processor = :nokogiri
40
+
41
+ or
42
+
43
+ OpenSRS::Server.xml_processor = :libxml
44
+
45
+ To connect, instantiate a new <tt>OpenSRS::Server</tt> object:
46
+
47
+ server = OpenSRS::Server.new(
48
+ server: "https://rr-n1-tor.opensrs.net:55443/",
49
+ username: "testing",
50
+ password: "53cr3t",
51
+ key: "c633be3170c7fb3fb29e2f99b84be2410..."
52
+ )
53
+
54
+ **NOTE:** Connecting to OpenSRS requires that you add the IP(s) you're connecting from to their whitelist. Log in to the testing or production servers, and add your IP(s) under Profile Management > Add IPs for Script/API Access. IP changes take about one hour to take effect.
55
+
56
+ If you would like, you can provide OpenSRS::Server with a logger to write the contents of the requests and responses
57
+ with OpenSRS. The assumption is you are using a Rails-like logger, but as long as your logger has an info method you
58
+ are fine. You can simply assign the logger or pass it in as an initialization option:
59
+
60
+ server = OpenSRS::Server.new(
61
+ server: "https://rr-n1-tor.opensrs.net:55443/",
62
+ username: "testing",
63
+ password: "53cr3t",
64
+ key: "c633be3170c7fb3fb29e2f99b84be2410...",
65
+ logger: Rails.logger
66
+ )
67
+
68
+ or, if you can change it later:
69
+
70
+ server.logger = Rails.logger
71
+
72
+ Once you have a server connection class, you can build from this to create the methods that you need. For instance, let's say we want to grab our account balance. The OpenSRS XML API takes a couple of attributes for all commands. You can include those here:
73
+
74
+ def get_balance
75
+ server.call(
76
+ action: "GET_BALANCE",
77
+ object: "BALANCE"
78
+ )
79
+ end
80
+
81
+ Sometimes you might need to include attributes for the command, such as a cookie, or the data attributes themselves. You can do this, too:
82
+
83
+ def create_nameserver(nameserver)
84
+ server.call(
85
+ action: "CREATE",
86
+ object: "NAMESERVER",
87
+ cookie: "366828736:3210384",
88
+ attributes: {
89
+ name: nameserver.hostname,
90
+ ipaddress: "212.112.123.11"
91
+ }
92
+ )
93
+ end
94
+
95
+ Responses from OpenSRS are returned in an OpenSRS::Response object, which gives you access to a multitude of things.
96
+
97
+ Method | Description
98
+ ---|---
99
+ `response.response` | This gives you the response in a Hash form, which is highly accessible to most other actions in your application.
100
+ `response.errors` | If there are errors which come back from OpenSRS, they are returned here. If not, it returns nil.
101
+ `response.success?` | Returns true if the response was labeled as successful. If not, it returns false.
102
+ `response.request_xml` | Returns raw request XML.
103
+ `response.response_xml` | Returns raw response XML.
104
+
105
+ ### Bugs/Feature Requests
106
+
107
+ If you have any bugs or feature requests for this gem, feel free to [open an issue.](http://github.com/voxxit/opensrs/issues/new)
108
+
109
+ ### How To Contribute
110
+
111
+ * Fork the project.
112
+ * Make your feature addition or bug fix.
113
+ * Add specs for it.
114
+ * Commit, but **do not mess with Rakefile or version.**
115
+ * Send me a pull request. Bonus points for topic branches!
116
+
117
+ ### Contributors (in order of appearance)
118
+
119
+ * [Joshua Delsman](http://github.com/voxxit)
120
+ * Glenn Roberts
121
+
122
+ ### Copyright
123
+
124
+ Copyright (c) 2010-2021 Joshua Delsman.
125
+
126
+ Distributed under the MIT license. See `LICENSE` for details.