lockitron 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0246c86899da0c2aef15c8eabd4de799cddcf17a
4
- data.tar.gz: eb8954188083b4be0f7f219fc0388f357c4f78c6
3
+ metadata.gz: 316a025f36fdcff8597cde27e315130e4c114341
4
+ data.tar.gz: b0cf9dc93f5c8890fa64616da3f148386515fb01
5
5
  SHA512:
6
- metadata.gz: 959d22f19aca2ddda63f8e4b1675adf1ea75e8e3041d0bb2c1a28eef1ba39c27d4de32e6de02a505ba6155c8625b3396a123096cb0ec4d20056ab0e14e9bc928
7
- data.tar.gz: 7017e0f1361f7431796cc5cc167e441cfae3c8d8c3d6bc8ec9c144fdf2546d3b14c9560af206453bc7878079d26082d0c3bc5f3cf40db42aaf346e16c9a7ada9
6
+ metadata.gz: 5d5df3a94ee0c7bcd8161e4ce39695e0c0d0ecf53f9e23f5cc08442dfaae134c210b562ba7d074335d800b9ab8e2c52d3206e7de986ef842a3d129ab79fc02ac
7
+ data.tar.gz: 4c3f541d5fd86765549c9dca7a3115b3aff1fc4309daa6689992c4d432d91c69536b9cf66cd36bf4bde0d699783498594f5f3edf24159bc418baab7be735ea8f
@@ -1 +1 @@
1
- 2.0.0-p195
1
+ 2.0.0
data/README.md CHANGED
@@ -14,12 +14,12 @@ Communicates with the [Lockitron API](http://api.lockitron.com)
14
14
 
15
15
  If you don't have an OAuth2 token already for the user of your app
16
16
 
17
- ``ruby
17
+ ```ruby
18
18
  auther = Lockitron::Auth.new(client_id: 'YOUR_OAUTH_CLIENT_ID', client_secret: 'YOUR_OAUTH_CLIENT_SECRET', redirect_uri: 'URI_FOR_CODE')
19
19
  auther.authorization_url #Send your user to this URL to authenticate your app
20
20
  auther.token_from_code 'code parameter on the redirect uri'
21
21
  auther.token # Store this, it is your token
22
- ``
22
+ ```
23
23
 
24
24
  To use, you will want a User object
25
25
 
@@ -45,7 +45,11 @@ module Lockitron
45
45
  # @return [Hash] API response
46
46
  def lock
47
47
  require_user
48
- @user.post "locks/#{@uuid}/lock"
48
+ begin
49
+ @user.post "locks/#{@uuid}/lock"
50
+ rescue ApiError
51
+ false
52
+ end
49
53
  end
50
54
 
51
55
  # Unlocks this lock
@@ -53,7 +57,11 @@ module Lockitron
53
57
  # @return [Hash] API response
54
58
  def unlock
55
59
  require_user
56
- @user.post "locks/#{@uuid}/unlock"
60
+ begin
61
+ @user.post "locks/#{@uuid}/unlock"
62
+ rescue ApiError
63
+ false
64
+ end
57
65
  end
58
66
 
59
67
  # Invites a user to this lock.
@@ -1,6 +1,8 @@
1
1
  require 'json'
2
2
  require_relative 'lock'
3
3
  module Lockitron
4
+ class AuthorizationError < RuntimeError; end
5
+ class ApiError < RuntimeError; end
4
6
  class User
5
7
  def initialize token
6
8
  @token = token
@@ -1,3 +1,3 @@
1
1
  module Lockitron
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -26,7 +26,6 @@ Gem::Specification.new do |s|
26
26
  s.require_paths = ["lib"]
27
27
 
28
28
  s.add_dependency 'faraday', ">= 0.8.4"
29
- s.add_dependency 'hashie'
30
29
  s.add_dependency 'oauth2'
31
30
  s.add_development_dependency 'rspec', ">= 2.8.0"
32
31
  s.add_development_dependency 'rdoc', ">= 3.12"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockitron
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Nelson
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.4
27
- - !ruby/object:Gem::Dependency
28
- name: hashie
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: oauth2
43
29
  requirement: !ruby/object:Gem::Requirement