evrythng 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
- require 'evrythng/authenticatable'
2
1
  require 'evrythng/config'
3
2
  require 'evrythng/connection'
4
3
  require 'evrythng/request'
@@ -6,7 +5,6 @@ require 'evrythng/request'
6
5
  module Evrythng
7
6
  # Wrapper for the Evrythng REST API
8
7
  class Client
9
- include Evrythng::Authenticatable
10
8
  include Evrythng::Connection
11
9
  include Evrythng::Request
12
10
 
@@ -40,6 +40,20 @@ module Evrythng
40
40
  def property_create(thng_id, key, value, options={})
41
41
  post("thngs/#{thng_id}/properties", options.merge(:key => key, :value => value))
42
42
  end
43
+
44
+ # Updates a property
45
+ #
46
+ # @param thng_id [String] The id of the thng to update property for.
47
+ # @param key [String] The key of property.
48
+ # @param value [String] The value of property.
49
+ # @param options [Hash] A customizable set of options.
50
+ # @return [Hash] The updated property.
51
+ # @see http://dev.evrythng.com/properties
52
+ # @example Update 'Volume' property for a thng with id 4f2133f39f5c550c2000016a
53
+ # Evrythng.property_update('4f2133f39f5c550c2000016a', 'Volume', '40')
54
+ def property_update(thng_id, key, value, options={})
55
+ put("thngs/#{thng_id}/properties/#{key}", options.merge(:value => value))
56
+ end
43
57
  end
44
58
  end
45
59
  end
@@ -35,7 +35,19 @@ module Evrythng
35
35
  # @example Create the authenticating user's thng
36
36
  # Evrythng.thng_create("my.test.thng", "Here comes the description.")
37
37
  def thng_create(name, description=nil, options={})
38
- post('thngs', options.merge(:name => name, :description => description))
38
+ post("thngs", options.merge(:name => name, :description => description))
39
+ end
40
+
41
+ # Updates a thng
42
+ #
43
+ # @param id [String] The id of thng.
44
+ # @param options [Hash] A customizable set of options.
45
+ # @return [Hash] The updated thng.
46
+ # @see http://dev.evrythng.com/thngs
47
+ # @example Update the authenticating user's thng with id 4f2133f39f5c550c2000016a
48
+ # Evrythng.thng_update('4f2133f39f5c550c2000016a', :name => 'my.test.thng.updated')
49
+ def thng_update(id, options={})
50
+ put("thngs/#{id}", options)
39
51
  end
40
52
  end
41
53
  end
@@ -1,3 +1,3 @@
1
1
  module Evrythng
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evrythng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70257168078720 !ruby/object:Gem::Requirement
16
+ requirement: &70327517663740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70257168078720
24
+ version_requirements: *70327517663740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70257168078300 !ruby/object:Gem::Requirement
27
+ requirement: &70327517663320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70257168078300
35
+ version_requirements: *70327517663320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: simplecov
38
- requirement: &70257168077880 !ruby/object:Gem::Requirement
38
+ requirement: &70327517662900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70257168077880
46
+ version_requirements: *70327517662900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: webmock
49
- requirement: &70257168077460 !ruby/object:Gem::Requirement
49
+ requirement: &70327517662480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70257168077460
57
+ version_requirements: *70327517662480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: yard
60
- requirement: &70257168077040 !ruby/object:Gem::Requirement
60
+ requirement: &70327517662060 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70257168077040
68
+ version_requirements: *70327517662060
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: json
71
- requirement: &70257168076620 !ruby/object:Gem::Requirement
71
+ requirement: &70327517661640 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70257168076620
79
+ version_requirements: *70327517661640
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: activesupport
82
- requirement: &70257168076080 !ruby/object:Gem::Requirement
82
+ requirement: &70327517661100 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: '4'
91
91
  type: :runtime
92
92
  prerelease: false
93
- version_requirements: *70257168076080
93
+ version_requirements: *70327517661100
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: faraday
96
- requirement: &70257168075320 !ruby/object:Gem::Requirement
96
+ requirement: &70327517660340 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ~>
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: 0.8.0.rc2
102
102
  type: :runtime
103
103
  prerelease: false
104
- version_requirements: *70257168075320
104
+ version_requirements: *70327517660340
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: multi_json
107
- requirement: &70257168074860 !ruby/object:Gem::Requirement
107
+ requirement: &70327517659880 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - ~>
@@ -112,7 +112,7 @@ dependencies:
112
112
  version: 1.0.0
113
113
  type: :runtime
114
114
  prerelease: false
115
- version_requirements: *70257168074860
115
+ version_requirements: *70327517659880
116
116
  description: A Ruby wrapper for Evrythng API.
117
117
  email: graf.otodrakula@gmail.com
118
118
  executables: []
@@ -125,7 +125,6 @@ files:
125
125
  - Rakefile
126
126
  - evrythng.gemspec
127
127
  - lib/evrythng.rb
128
- - lib/evrythng/authenticatable.rb
129
128
  - lib/evrythng/client.rb
130
129
  - lib/evrythng/client/collections.rb
131
130
  - lib/evrythng/client/properties.rb
@@ -1,21 +0,0 @@
1
- module Evrythng
2
- module Authenticatable
3
-
4
- # Credentials hash
5
- #
6
- # @return [Hash]
7
- def credentials
8
- {
9
- :token => token
10
- }
11
- end
12
-
13
- # Check whether credentials are present
14
- #
15
- # @return [Boolean]
16
- def credentials?
17
- credentials.values.all?
18
- end
19
-
20
- end
21
- end