helium-ruby 0.3.0 → 0.4.0

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.
data/lib/helium/user.rb CHANGED
@@ -1,22 +1,20 @@
1
1
  module Helium
2
- class User
3
- attr_accessor :id, :name, :email, :created_at, :updated_at
2
+ class User < Resource
3
+ attr_reader :name, :email
4
4
 
5
5
  def initialize(client:, params:)
6
- @client = client
7
- @id = params["id"]
8
- @name = params["attributes"]["name"]
9
- @email = params["meta"]["email"]
10
- @created_at = params["meta"]["created"]
11
- @updated_at = params["meta"]["updated"]
12
- end
6
+ super(client: client, params: params)
13
7
 
14
- def created_at
15
- DateTime.parse(@created_at)
8
+ @name = params.dig('attributes', 'name')
9
+ @email = params.dig('meta', 'email')
16
10
  end
17
11
 
18
- def updated_at
19
- DateTime.parse(@updated_at)
12
+ # TODO can probably generalize this a bit more
13
+ def as_json
14
+ super.merge({
15
+ name: name,
16
+ email: email
17
+ })
20
18
  end
21
19
  end
22
20
  end
@@ -1,3 +1,3 @@
1
1
  module Helium
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helium-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Allen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -246,13 +246,18 @@ files:
246
246
  - bin/setup
247
247
  - docs/Helium.html
248
248
  - docs/Helium/Client.html
249
+ - docs/Helium/Client/Elements.html
249
250
  - docs/Helium/Client/Http.html
251
+ - docs/Helium/Client/Labels.html
250
252
  - docs/Helium/Client/Organizations.html
251
253
  - docs/Helium/Client/Sensors.html
252
254
  - docs/Helium/Client/Users.html
253
255
  - docs/Helium/Cursor.html
254
256
  - docs/Helium/DataPoint.html
257
+ - docs/Helium/Element.html
258
+ - docs/Helium/Label.html
255
259
  - docs/Helium/Organization.html
260
+ - docs/Helium/Resource.html
256
261
  - docs/Helium/Sensor.html
257
262
  - docs/Helium/User.html
258
263
  - docs/Helium/Utils.html
@@ -273,13 +278,18 @@ files:
273
278
  - helium-ruby.gemspec
274
279
  - lib/helium.rb
275
280
  - lib/helium/client.rb
281
+ - lib/helium/client/elements.rb
276
282
  - lib/helium/client/http.rb
283
+ - lib/helium/client/labels.rb
277
284
  - lib/helium/client/organizations.rb
278
285
  - lib/helium/client/sensors.rb
279
286
  - lib/helium/client/users.rb
280
287
  - lib/helium/cursor.rb
281
288
  - lib/helium/data_point.rb
289
+ - lib/helium/element.rb
290
+ - lib/helium/label.rb
282
291
  - lib/helium/organization.rb
292
+ - lib/helium/resource.rb
283
293
  - lib/helium/sensor.rb
284
294
  - lib/helium/user.rb
285
295
  - lib/helium/utils.rb