This is a Ruby gem that serves as a wrapper for Internet Solutions' Quick Lookup Tool (QLT) API.
Add this line to your application's Gemfile:
gem 'qlt', github: 'siyelo/qlt'
And then execute:
$ bundle
Configuration is done by setting the API environment you want to use. Example:
Qlt.configure do |config|
config.env = :production # or :development
end
Fetching of available solutions (and the price) is done via the Qlt.lookup
method.
Qlt.lookup({
latitude: 12.12,
longitude: 13.13,
with_wireless: true,
speed: 10, # MBps
contract_length: 12, # Months
account_manager: "John Doe", # Account Manager Name
company_name: "Siyelo", # Name of the client
address: "Some Address 123", # Address to identify the site
opt_ref: 12 # ID of the OPT Quote
})
This sends a lookup request for the given arguments. Returns a Qlt::Response
object that contains:
- the searched coordinates (as a Qlt::Location entity)
- the price of the solutions (as a Qlt::Price entity)
- a list of possible solutions (as an Array)
- a solution can be of type
Qlt::FibreNode
orQlt::WiFiNode
- a solution can be of type
Qlt::Response
is an entity that holds all of the returned data from the QLT API.reference_number
is the QLT reference number for the LM solution saved on QLT side.
Qlt::Location
is an entity representing a location, holds the latitude and longitude coordinates.Qlt::Price
is an entity that holds the pricing data. Contains the mrc and nrc prices.Qlt::WifiNode
is an entity representing a WiFi solution. Contains:type
name
- the name of the nodedistance
- distance between the node and the customer locationlocation
- Qlt::Location object, representing the location of the node
Qlt::FibreNode
is an entity representing a Fibre solution. Contains:zone
- the zone where the node istype
name
- the name of the nodedistance
- distance between the node and the customer locationlocation
- Qlt::Location object, representing the location of the node
Currently, since we are not writing data to the API, authentication headers are not needed.
There's code in place for that, but it's out of the current scope. In the future if
the gem should write customer solution data to the QLT, the key
and secret
attributes
should be added as a part of the gem runtime configuration, like:
Qlt.configure do |c|
c.env = :production # or :development
c.key = 'YOUR_KEY'
c.secret = 'YOUR_SECRET'
end
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
- Fork it ( https://github.com/[my-github-username]/qlt/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request