geckoboard-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.
- checksums.yaml +4 -4
- data/CHANGELOG.rb +9 -0
- data/README.md +2 -1
- data/lib/geckoboard/field_types.rb +20 -6
- data/lib/geckoboard/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d1d6563738b8727ff193ddedcfb668316baa33
|
4
|
+
data.tar.gz: bd0f878b81f8f5a14b0d77688a39838b0c423a6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f2d59492daa2dcb37c3f9c324dae8e39a214cb559cfec13b0e269b8facecd4fe6ab638f35ccb9197930849af02eae4868fe6d40943cb53ba8f33164d1d4fa3
|
7
|
+
data.tar.gz: b39cccdc1b5beec215f76f00759c2a1494424f6b243377ce0cf5c95428a260f63347678b26acd233c232e8f2f980cb3d6f6b72d53c8dc8afcb07f9d767e9d3a2
|
data/CHANGELOG.rb
ADDED
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(:
|
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, "`
|
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 <
|
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 <
|
55
|
+
class MoneyField < OptionalField
|
42
56
|
attr_reader :currency_code
|
43
57
|
|
44
|
-
def initialize(id,
|
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,
|
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 <
|
70
|
+
class PercentageField < OptionalField
|
57
71
|
def to_hash
|
58
72
|
super.merge(type: :percentage)
|
59
73
|
end
|
data/lib/geckoboard/version.rb
CHANGED
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.
|
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-
|
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.
|
116
|
+
rubygems_version: 2.5.1
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
119
|
summary: Ruby client library for Geckoboard
|