ruby-miradore 0.1.0 → 0.1.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: d8c368a1181c4b4fc018a7cc4a78a5a4dc68e681e6ff4ada43eee4fb412db6f4
4
- data.tar.gz: 4c09338936fa847d3f0cb02497db1ad0afa0515cdce7b8d268ff5d7e03728c0a
3
+ metadata.gz: 3a2d7224c804d8330fdd5af6a4f59812484057f75b317f11a2d0501a32b7d637
4
+ data.tar.gz: 4f6f3898d4f2a378e37059172b671d87fb8202cea5955880477c1c293726f866
5
5
  SHA512:
6
- metadata.gz: 5bfc76b919333a1955dafe1c84ec0b5ec0ef4ad8572c5e6c4959a657a11b0a431838878c558688f1f124164a5f0fe2fc7cae8d830d7b927647ee9886542e77dc
7
- data.tar.gz: 2a97c7a25e6f859cc48fdba90f86036e3e93f68f39dc1e7a56144fda431d2a0d0bd674740ecb7e968e73d82472aef78e66583b76feec5927d4b28890f5b72c54
6
+ metadata.gz: ed281193865b2c9426fac2fab0fa0f3ed82801562d25effc7a81bdbe566f55514b40d3297b66d0af31cdb690d22002e063c599eb94bd92f0e721443b57455481
7
+ data.tar.gz: ccb8a22f0d3f125ab3c930aa34e635af842d69f14f2b28e3ed5948603ca615dfe35065d1948c7da11e205f792b835652f5b9ecce20ebb4b2c50af47175b230c5
data/Gemfile CHANGED
@@ -10,3 +10,4 @@ gem "rspec", "~> 3.0"
10
10
  gem "rubocop", "~> 1.7"
11
11
  gem "httparty"
12
12
  gem "finest-builder", "~> 0.0.4"
13
+ gem "crack"
data/lib/ruby/miradore.rb CHANGED
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "miradore/version"
4
+ require 'httparty'
5
+ require 'json'
6
+ require 'crack/xml'
7
+ require 'finest/builder'
4
8
 
5
9
  module Ruby
6
10
  module Miradore
7
11
  class Error < StandardError; end
8
12
 
9
- @@msp_api_key = ENV['MSP_API_KEY']
13
+ @@msp_api_key = ENV['MSP_API_KEY'] || '3_IHBPttQ.ub[OG27'
14
+
10
15
 
11
16
  def self.api_key
12
17
  @@msp_api_key
@@ -30,7 +35,7 @@ module Ruby
30
35
  attr_reader :subdomain
31
36
 
32
37
  def self.all(subdomain, *args)
33
- response = JSON.parse(Hash.from_trusted_xml(get(Miradore::url(:v1, subdomain)).body).to_json, :quirks_mode => true).dig("Content", "Items", "Device")
38
+ response = JSON.parse(Crack::XML.parse(get(Miradore::url(:v1, subdomain)).body).to_json, :quirks_mode => true).dig("Content", "Items", "Device")
34
39
  if response.is_a?(Array)
35
40
  response.map! { |e| Device.new(e.transform_keys(&:downcase), subdomain) }
36
41
  else
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ruby
4
4
  module Miradore
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-miradore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduard
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  requirements: []
58
- rubygems_version: 3.1.4
58
+ rubygems_version: 3.1.6
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: Miradore is a MSP providing an API to get devices information as well s perform