farmbot-resource 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -2
  3. data/lib/client.rb +6 -2
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55262027f1ae26bc9dc97e1ef4792834a8680b48
4
- data.tar.gz: ab3c489d840fbe3486594184c1602fef86f8e63f
3
+ metadata.gz: 260a098d3d3a67d135108ca2a9a1179ae60e9798
4
+ data.tar.gz: 3d7c3505e9af3af0283075e5044fe0a8a378129b
5
5
  SHA512:
6
- metadata.gz: 7d9ca8dc7c9d1c523b9dc9c614cde07eab9ff406fcc114041042491abf33bd36d82f424a404c4bb2ccdef06d3a5a32dca9357a297f8514f8c9c4767eb25685c2
7
- data.tar.gz: 2d17f2764e0807c878330f9e7d9a48848e714b202b0568c759ec0c7ffbb287cfcd7d55abd622bc4c27bd3c0c6503bdf2dcb77522e2ccebbf9400e488e4944094
6
+ metadata.gz: ee68a0e3020cdfa857dfe93e9fe88712a5cc87aee8fc76f9fda6c1fcc10711f2580c149a44561b880c0da3596ec9455a599d73a0d3a0ae108f425c92fff1051b
7
+ data.tar.gz: 595bc5add1ad06a4515bfabc37665771ba667fdba1809e32cc746fac90529d4c229d0bbd37711bc103c35969b67207fd177a54cfb9abed2e0a0ac203bd1c4ac1
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # gem 'rspec'
4
- # gem 'simplecov'
5
3
  gem 'rest-client'
@@ -32,8 +32,12 @@ module FbResource
32
32
  end
33
33
 
34
34
  def self.public_key(url = "my.farmbot.io")
35
- pem = Http.get(url + "/api/public_key", {}).body
36
- @public_key = OpenSSL::PKey::RSA.new(pem)
35
+ wow = Http.get(url + "/api/public_key", {})
36
+ if wow.response.code.to_i < 400
37
+ return OpenSSL::PKey::RSA.new(wow.body)
38
+ else
39
+ raise "Unable to fetch public key. Is the server down?"
40
+ end
37
41
  end
38
42
 
39
43
  def device
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: farmbot-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Carlino
@@ -148,3 +148,4 @@ specification_version: 4
148
148
  summary: Ruby Gem to access resources on Farmbot Web App
149
149
  test_files:
150
150
  - spec/spec_helper.rb
151
+ has_rdoc: