
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Ruby API client for XN Logic based applications.
Source code available at https://github.com/xnlogic/xn.rb and Pull Requests are welcome!
Set up and authentication:
require 'rubygems'
require 'xn.rb'
api_session = Xn::XnApiSession.new 'https://app.lightmesh.com', 'my@email.com'
This will prompt the terminal for your password. If you are not writing an interactive script, set the LMTOKEN environment variable first and the XnApiSession constructor will use that. e.g.
~/my_project $ LMTOKEN='client_name XYZ1234' irb
2.1.0p0 :001 > require 'rubygems'
2.1.0p0 :002 > require 'xn.rb'
2.1.0p0 :003 > api_session = Xn::XnApiSession.new 'https://app.lightmesh.com', 'my@email.com'
2.1.0p0 :004 > Using token from env LMTOKEN
=> #<Xn::XnApiSession:0x007feef5c65070.....>
2.1.0p0 :005 >
To query the API, there are a few helpers:
# NB: These two queries return subtly different results. The first returns a Model record, with all Parts your user
# has access to, whereas the second returns just the Part data. For more on the difference between Models and Parts see:
# https://lightmesh.zendesk.com/entries/41374508-Concepts-Types-or-parts-and-Models for
response_hash = api_session.find_vertex_by_model 'ip', '/filter/name?name=10.0.0.2'
response_hash = api_session.find_vertex_by_part 'ip', '/filter/name?name=10.0.0.2'
# Create, Update, Find-or-Create:
new_ip_r_hash = api_session.create_vertex 'ip', name: '10.0.0.3', description: 'New reserved IP for projekt XYZ'
response_hash = api_session.update_vertex new_ip_r_hash, description: 'New reserved IP for project XYZ'
response_hash = api_session.find_or_create_by_model_and_name('ip', '10.0.0.3', nil, description: 'New reserved IP for project XYZ')
# Get all related vertices:
api_session.related_vertices(new_ip_r_hash)
# Execute an action:
api_session.exec_action( new_ip_r_hash, 'set_subnet_from_ip', {} ) # Some actions take paramters in the form of a hash
We are always interested in hearing suggestions for more helpers (open an issue at https://github.com/xnlogic/xn.rb)
but you can also use the API http wrapper directly for more advanced use-cases:
api_session.api.get "/v1/is/ip/filters/name/properties/name/?name[regex]=^(?!10)" do |response|
response.each do |id, ip|
puts "IP: #{ip}, xnid: /model/ip/#{id}"
end
end
FAQs
Unknown package
We found that xn.rb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.