geckoboard-ruby 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 761434e8773946c7a9a6f111acc2aa2814c44ff5
4
- data.tar.gz: 6fd826b8679091d0c49126e495fce06c2a687d1c
3
+ metadata.gz: 46d1d6563738b8727ff193ddedcfb668316baa33
4
+ data.tar.gz: bd0f878b81f8f5a14b0d77688a39838b0c423a6c
5
5
  SHA512:
6
- metadata.gz: 6001b746389178795c7072919d982c116e217252be9be379c4ecf2ef0977b933f61c0b4e19e05878ea42e03aaaec428bdd6cf6b054c84d8d596d0d382e50099a
7
- data.tar.gz: d80f695524f168add1407eb7bee8d2464a047210303d5b33cfd6128fba0b53ee5c25743ba6922f8a29b8f5793c002b32ec9842359830c4ccf66528844add6d64
6
+ metadata.gz: b4f2d59492daa2dcb37c3f9c324dae8e39a214cb559cfec13b0e269b8facecd4fe6ab638f35ccb9197930849af02eae4868fe6d40943cb53ba8f33164d1d4fa3
7
+ data.tar.gz: b39cccdc1b5beec215f76f00759c2a1494424f6b243377ce0cf5c95428a260f63347678b26acd233c232e8f2f980cb3d6f6b72d53c8dc8afcb07f9d767e9d3a2
@@ -0,0 +1,9 @@
1
+ ## 0.4.0
2
+
3
+ FEATURES:
4
+
5
+ * Add support for `optional` values on numeric field types
6
+
7
+ BUG FIXES:
8
+
9
+ * Make Dataset name optional and id required
data/README.md CHANGED
@@ -36,8 +36,9 @@ Verify an existing dataset or create a new one.
36
36
 
37
37
  ```ruby
38
38
  dataset = client.datasets.find_or_create('sales.gross', fields: [
39
- Geckoboard::MoneyField.new(:amount, name: 'Amount', currency_code: 'USD'),
39
+ Geckoboard::MoneyField.new(:cost, name: 'Cost', currency_code: 'USD'),
40
40
  Geckoboard::DateTimeField.new(:timestamp, name: 'Time'),
41
+ Geckoboard::NumberField(:amount, name: 'Amount', optional: true)
41
42
  ], unique_by: [:timestamp])
42
43
  ```
43
44
 
@@ -3,7 +3,7 @@ module Geckoboard
3
3
  attr_reader :id, :name
4
4
 
5
5
  def initialize(id, name: nil)
6
- raise ArgumentError, "`name:' is a required argument" if name.nil?
6
+ raise ArgumentError, "`id:' is a required argument" if id.nil?
7
7
 
8
8
  @id = id
9
9
  @name = name
@@ -14,13 +14,27 @@ module Geckoboard
14
14
  end
15
15
  end
16
16
 
17
+ class OptionalField < Field
18
+ attr_reader :optional
19
+
20
+ def initialize(id, optional: false, **options)
21
+ super(id, **options)
22
+
23
+ @optional = optional
24
+ end
25
+
26
+ def to_hash
27
+ super.merge(optional: @optional)
28
+ end
29
+ end
30
+
17
31
  class StringField < Field
18
32
  def to_hash
19
33
  super.merge(type: :string)
20
34
  end
21
35
  end
22
36
 
23
- class NumberField < Field
37
+ class NumberField < OptionalField
24
38
  def to_hash
25
39
  super.merge(type: :number)
26
40
  end
@@ -38,13 +52,13 @@ module Geckoboard
38
52
  end
39
53
  end
40
54
 
41
- class MoneyField < Field
55
+ class MoneyField < OptionalField
42
56
  attr_reader :currency_code
43
57
 
44
- def initialize(id, name: nil, currency_code: nil)
58
+ def initialize(id, currency_code: nil, **options)
45
59
  raise ArgumentError, "`currency_code:' is a required argument" if currency_code.nil?
46
60
 
47
- super(id, name: name)
61
+ super(id, **options)
48
62
  @currency_code = currency_code
49
63
  end
50
64
 
@@ -53,7 +67,7 @@ module Geckoboard
53
67
  end
54
68
  end
55
69
 
56
- class PercentageField < Field
70
+ class PercentageField < OptionalField
57
71
  def to_hash
58
72
  super.merge(type: :percentage)
59
73
  end
@@ -1,3 +1,3 @@
1
1
  module Geckoboard
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: geckoboard-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
  - Daniel Upton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-03 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
+ - CHANGELOG.rb
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md
@@ -112,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  version: '0'
113
114
  requirements: []
114
115
  rubyforge_project:
115
- rubygems_version: 2.2.0
116
+ rubygems_version: 2.5.1
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: Ruby client library for Geckoboard