activitysmith 1.2.0 → 1.2.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 +4 -4
- data/README.md +1 -1
- data/generated/activitysmith_openapi/api/metrics_api.rb +2 -2
- data/generated/activitysmith_openapi/models/metric_value_update_response.rb +11 -11
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +0 -4
- data/lib/activitysmith/version.rb +1 -1
- metadata +1 -5
- data/generated/activitysmith_openapi/models/metric_format.rb +0 -43
- data/generated/activitysmith_openapi/models/metric_unit_spacing.rb +0 -40
- data/generated/activitysmith_openapi/models/widget_metric.rb +0 -507
- data/generated/activitysmith_openapi/models/widget_metric_latest_value.rb +0 -105
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d995d89c48fd76a480d106695dfef4c3c85bf2ed9d8613f1ba0c132367a35bc1
|
|
4
|
+
data.tar.gz: 026f8d00b5b30e26b0dcaca41143f3a644fa801462c5d05949ab28f4f6195738
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a1fcac1bec72a9993314cc2eee1ae4ab5a9e0c7c8941a78978214efc88be481dca1d3caec09f95b3be9d337f3cdfe11e2c4a3080b331071330eaba45b7e306ce
|
|
7
|
+
data.tar.gz: ba2a9963e7c8d8b324d0a9e70a6d39cc4405ab66331a3cac32c355ad88614593f5e886568c7c0bc0ee44a0177709f81c84956fe77671f835c2edff034e94aae9
|
data/README.md
CHANGED
|
@@ -561,7 +561,7 @@ activitysmith.notifications.send(
|
|
|
561
561
|
<img src="https://cdn.activitysmith.com/features/lock-screen-widgets.png" alt="Lock screen widgets" width="680" />
|
|
562
562
|
</p>
|
|
563
563
|
|
|
564
|
-
ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the web app
|
|
564
|
+
ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the <a href="https://activitysmith.com/app/widgets" target="_blank" rel="noopener noreferrer">web app</a>, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
|
|
565
565
|
|
|
566
566
|
<p align="center">
|
|
567
567
|
<img src="https://cdn.activitysmith.com/features/create-widget-metric.png" alt="Create widget metric" width="680" />
|
|
@@ -20,7 +20,7 @@ module OpenapiClient
|
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
22
|
# Update a widget metric value
|
|
23
|
-
# Updates the latest value for a metric
|
|
23
|
+
# Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.
|
|
24
24
|
# @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
|
|
25
25
|
# @param metric_value_update_request [MetricValueUpdateRequest]
|
|
26
26
|
# @param [Hash] opts the optional parameters
|
|
@@ -31,7 +31,7 @@ module OpenapiClient
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# Update a widget metric value
|
|
34
|
-
# Updates the latest value for a metric
|
|
34
|
+
# Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.
|
|
35
35
|
# @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed.
|
|
36
36
|
# @param metric_value_update_request [MetricValueUpdateRequest]
|
|
37
37
|
# @param [Hash] opts the optional parameters
|
|
@@ -15,12 +15,12 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
17
|
class MetricValueUpdateResponse
|
|
18
|
-
attr_accessor :
|
|
18
|
+
attr_accessor :success
|
|
19
19
|
|
|
20
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
21
|
def self.attribute_map
|
|
22
22
|
{
|
|
23
|
-
:'
|
|
23
|
+
:'success' => :'success'
|
|
24
24
|
}
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ module OpenapiClient
|
|
|
32
32
|
# Attribute type mapping.
|
|
33
33
|
def self.openapi_types
|
|
34
34
|
{
|
|
35
|
-
:'
|
|
35
|
+
:'success' => :'Boolean'
|
|
36
36
|
}
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -57,10 +57,10 @@ module OpenapiClient
|
|
|
57
57
|
h[k.to_sym] = v
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
if attributes.key?(:'
|
|
61
|
-
self.
|
|
60
|
+
if attributes.key?(:'success')
|
|
61
|
+
self.success = attributes[:'success']
|
|
62
62
|
else
|
|
63
|
-
self.
|
|
63
|
+
self.success = nil
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -69,8 +69,8 @@ module OpenapiClient
|
|
|
69
69
|
def list_invalid_properties
|
|
70
70
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
71
71
|
invalid_properties = Array.new
|
|
72
|
-
if @
|
|
73
|
-
invalid_properties.push('invalid value for "
|
|
72
|
+
if @success.nil?
|
|
73
|
+
invalid_properties.push('invalid value for "success", success cannot be nil.')
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
invalid_properties
|
|
@@ -80,7 +80,7 @@ module OpenapiClient
|
|
|
80
80
|
# @return true if the model is valid
|
|
81
81
|
def valid?
|
|
82
82
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
83
|
-
return false if @
|
|
83
|
+
return false if @success.nil?
|
|
84
84
|
true
|
|
85
85
|
end
|
|
86
86
|
|
|
@@ -89,7 +89,7 @@ module OpenapiClient
|
|
|
89
89
|
def ==(o)
|
|
90
90
|
return true if self.equal?(o)
|
|
91
91
|
self.class == o.class &&
|
|
92
|
-
|
|
92
|
+
success == o.success
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
# @see the `==` method
|
|
@@ -101,7 +101,7 @@ module OpenapiClient
|
|
|
101
101
|
# Calculates hash code according to all attributes.
|
|
102
102
|
# @return [Integer] Hash code
|
|
103
103
|
def hash
|
|
104
|
-
[
|
|
104
|
+
[success].hash
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
# Builds the object from hash
|
|
@@ -40,8 +40,6 @@ require 'activitysmith_openapi/models/live_activity_update_request'
|
|
|
40
40
|
require 'activitysmith_openapi/models/live_activity_update_response'
|
|
41
41
|
require 'activitysmith_openapi/models/live_activity_webhook_method'
|
|
42
42
|
require 'activitysmith_openapi/models/metric_error'
|
|
43
|
-
require 'activitysmith_openapi/models/metric_format'
|
|
44
|
-
require 'activitysmith_openapi/models/metric_unit_spacing'
|
|
45
43
|
require 'activitysmith_openapi/models/metric_value_update_request'
|
|
46
44
|
require 'activitysmith_openapi/models/metric_value_update_request_value'
|
|
47
45
|
require 'activitysmith_openapi/models/metric_value_update_response'
|
|
@@ -55,8 +53,6 @@ require 'activitysmith_openapi/models/push_notification_webhook_method'
|
|
|
55
53
|
require 'activitysmith_openapi/models/rate_limit_error'
|
|
56
54
|
require 'activitysmith_openapi/models/send_push_notification429_response'
|
|
57
55
|
require 'activitysmith_openapi/models/stream_content_state'
|
|
58
|
-
require 'activitysmith_openapi/models/widget_metric'
|
|
59
|
-
require 'activitysmith_openapi/models/widget_metric_latest_value'
|
|
60
56
|
|
|
61
57
|
# APIs
|
|
62
58
|
require 'activitysmith_openapi/api/live_activities_api'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activitysmith
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ActivitySmith
|
|
@@ -105,8 +105,6 @@ files:
|
|
|
105
105
|
- generated/activitysmith_openapi/models/live_activity_update_response.rb
|
|
106
106
|
- generated/activitysmith_openapi/models/live_activity_webhook_method.rb
|
|
107
107
|
- generated/activitysmith_openapi/models/metric_error.rb
|
|
108
|
-
- generated/activitysmith_openapi/models/metric_format.rb
|
|
109
|
-
- generated/activitysmith_openapi/models/metric_unit_spacing.rb
|
|
110
108
|
- generated/activitysmith_openapi/models/metric_value_update_request.rb
|
|
111
109
|
- generated/activitysmith_openapi/models/metric_value_update_request_value.rb
|
|
112
110
|
- generated/activitysmith_openapi/models/metric_value_update_response.rb
|
|
@@ -120,8 +118,6 @@ files:
|
|
|
120
118
|
- generated/activitysmith_openapi/models/rate_limit_error.rb
|
|
121
119
|
- generated/activitysmith_openapi/models/send_push_notification429_response.rb
|
|
122
120
|
- generated/activitysmith_openapi/models/stream_content_state.rb
|
|
123
|
-
- generated/activitysmith_openapi/models/widget_metric.rb
|
|
124
|
-
- generated/activitysmith_openapi/models/widget_metric_latest_value.rb
|
|
125
121
|
- generated/activitysmith_openapi/version.rb
|
|
126
122
|
- lib/activitysmith.rb
|
|
127
123
|
- lib/activitysmith/client.rb
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#ActivitySmith API
|
|
3
|
-
|
|
4
|
-
#Send push notifications and Live Activities to your own devices via a single API key.
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.7.0
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'date'
|
|
14
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module OpenapiClient
|
|
17
|
-
class MetricFormat
|
|
18
|
-
NUMBER = "number".freeze
|
|
19
|
-
CURRENCY = "currency".freeze
|
|
20
|
-
PERCENT = "percent".freeze
|
|
21
|
-
UNIT = "unit".freeze
|
|
22
|
-
STRING = "string".freeze
|
|
23
|
-
|
|
24
|
-
def self.all_vars
|
|
25
|
-
@all_vars ||= [NUMBER, CURRENCY, PERCENT, UNIT, STRING].freeze
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Builds the enum from string
|
|
29
|
-
# @param [String] The enum value in the form of the string
|
|
30
|
-
# @return [String] The enum value
|
|
31
|
-
def self.build_from_hash(value)
|
|
32
|
-
new.build_from_hash(value)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Builds the enum from string
|
|
36
|
-
# @param [String] The enum value in the form of the string
|
|
37
|
-
# @return [String] The enum value
|
|
38
|
-
def build_from_hash(value)
|
|
39
|
-
return value if MetricFormat.all_vars.include?(value)
|
|
40
|
-
raise "Invalid ENUM value #{value} for class #MetricFormat"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#ActivitySmith API
|
|
3
|
-
|
|
4
|
-
#Send push notifications and Live Activities to your own devices via a single API key.
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.7.0
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'date'
|
|
14
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module OpenapiClient
|
|
17
|
-
class MetricUnitSpacing
|
|
18
|
-
NONE = "none".freeze
|
|
19
|
-
SPACE = "space".freeze
|
|
20
|
-
|
|
21
|
-
def self.all_vars
|
|
22
|
-
@all_vars ||= [NONE, SPACE].freeze
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Builds the enum from string
|
|
26
|
-
# @param [String] The enum value in the form of the string
|
|
27
|
-
# @return [String] The enum value
|
|
28
|
-
def self.build_from_hash(value)
|
|
29
|
-
new.build_from_hash(value)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Builds the enum from string
|
|
33
|
-
# @param [String] The enum value in the form of the string
|
|
34
|
-
# @return [String] The enum value
|
|
35
|
-
def build_from_hash(value)
|
|
36
|
-
return value if MetricUnitSpacing.all_vars.include?(value)
|
|
37
|
-
raise "Invalid ENUM value #{value} for class #MetricUnitSpacing"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,507 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#ActivitySmith API
|
|
3
|
-
|
|
4
|
-
#Send push notifications and Live Activities to your own devices via a single API key.
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.7.0
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'date'
|
|
14
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module OpenapiClient
|
|
17
|
-
# A metric configured for ActivitySmith widgets.
|
|
18
|
-
class WidgetMetric
|
|
19
|
-
attr_accessor :public_id
|
|
20
|
-
|
|
21
|
-
attr_accessor :key
|
|
22
|
-
|
|
23
|
-
attr_accessor :label
|
|
24
|
-
|
|
25
|
-
# Present when format is currency.
|
|
26
|
-
attr_accessor :currency_code
|
|
27
|
-
|
|
28
|
-
# Present when format is unit.
|
|
29
|
-
attr_accessor :unit
|
|
30
|
-
|
|
31
|
-
attr_accessor :unit_spacing
|
|
32
|
-
|
|
33
|
-
attr_accessor :format
|
|
34
|
-
|
|
35
|
-
attr_accessor :latest_value
|
|
36
|
-
|
|
37
|
-
attr_accessor :latest_value_at
|
|
38
|
-
|
|
39
|
-
attr_accessor :created_at
|
|
40
|
-
|
|
41
|
-
attr_accessor :updated_at
|
|
42
|
-
|
|
43
|
-
class EnumAttributeValidator
|
|
44
|
-
attr_reader :datatype
|
|
45
|
-
attr_reader :allowable_values
|
|
46
|
-
|
|
47
|
-
def initialize(datatype, allowable_values)
|
|
48
|
-
@allowable_values = allowable_values.map do |value|
|
|
49
|
-
case datatype.to_s
|
|
50
|
-
when /Integer/i
|
|
51
|
-
value.to_i
|
|
52
|
-
when /Float/i
|
|
53
|
-
value.to_f
|
|
54
|
-
else
|
|
55
|
-
value
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def valid?(value)
|
|
61
|
-
!value || allowable_values.include?(value)
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
|
66
|
-
def self.attribute_map
|
|
67
|
-
{
|
|
68
|
-
:'public_id' => :'public_id',
|
|
69
|
-
:'key' => :'key',
|
|
70
|
-
:'label' => :'label',
|
|
71
|
-
:'currency_code' => :'currency_code',
|
|
72
|
-
:'unit' => :'unit',
|
|
73
|
-
:'unit_spacing' => :'unit_spacing',
|
|
74
|
-
:'format' => :'format',
|
|
75
|
-
:'latest_value' => :'latest_value',
|
|
76
|
-
:'latest_value_at' => :'latest_value_at',
|
|
77
|
-
:'created_at' => :'created_at',
|
|
78
|
-
:'updated_at' => :'updated_at'
|
|
79
|
-
}
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Returns all the JSON keys this model knows about
|
|
83
|
-
def self.acceptable_attributes
|
|
84
|
-
attribute_map.values
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
# Attribute type mapping.
|
|
88
|
-
def self.openapi_types
|
|
89
|
-
{
|
|
90
|
-
:'public_id' => :'String',
|
|
91
|
-
:'key' => :'String',
|
|
92
|
-
:'label' => :'String',
|
|
93
|
-
:'currency_code' => :'String',
|
|
94
|
-
:'unit' => :'String',
|
|
95
|
-
:'unit_spacing' => :'MetricUnitSpacing',
|
|
96
|
-
:'format' => :'MetricFormat',
|
|
97
|
-
:'latest_value' => :'WidgetMetricLatestValue',
|
|
98
|
-
:'latest_value_at' => :'Time',
|
|
99
|
-
:'created_at' => :'Time',
|
|
100
|
-
:'updated_at' => :'Time'
|
|
101
|
-
}
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
# List of attributes with nullable: true
|
|
105
|
-
def self.openapi_nullable
|
|
106
|
-
Set.new([
|
|
107
|
-
:'currency_code',
|
|
108
|
-
:'unit',
|
|
109
|
-
:'latest_value',
|
|
110
|
-
:'latest_value_at',
|
|
111
|
-
])
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
# Initializes the object
|
|
115
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
-
def initialize(attributes = {})
|
|
117
|
-
if (!attributes.is_a?(Hash))
|
|
118
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::WidgetMetric` initialize method"
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
|
122
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
123
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
|
124
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::WidgetMetric`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
125
|
-
end
|
|
126
|
-
h[k.to_sym] = v
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if attributes.key?(:'public_id')
|
|
130
|
-
self.public_id = attributes[:'public_id']
|
|
131
|
-
else
|
|
132
|
-
self.public_id = nil
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
if attributes.key?(:'key')
|
|
136
|
-
self.key = attributes[:'key']
|
|
137
|
-
else
|
|
138
|
-
self.key = nil
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
if attributes.key?(:'label')
|
|
142
|
-
self.label = attributes[:'label']
|
|
143
|
-
else
|
|
144
|
-
self.label = nil
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
if attributes.key?(:'currency_code')
|
|
148
|
-
self.currency_code = attributes[:'currency_code']
|
|
149
|
-
else
|
|
150
|
-
self.currency_code = nil
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
if attributes.key?(:'unit')
|
|
154
|
-
self.unit = attributes[:'unit']
|
|
155
|
-
else
|
|
156
|
-
self.unit = nil
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
if attributes.key?(:'unit_spacing')
|
|
160
|
-
self.unit_spacing = attributes[:'unit_spacing']
|
|
161
|
-
else
|
|
162
|
-
self.unit_spacing = nil
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
if attributes.key?(:'format')
|
|
166
|
-
self.format = attributes[:'format']
|
|
167
|
-
else
|
|
168
|
-
self.format = nil
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
if attributes.key?(:'latest_value')
|
|
172
|
-
self.latest_value = attributes[:'latest_value']
|
|
173
|
-
else
|
|
174
|
-
self.latest_value = nil
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
if attributes.key?(:'latest_value_at')
|
|
178
|
-
self.latest_value_at = attributes[:'latest_value_at']
|
|
179
|
-
else
|
|
180
|
-
self.latest_value_at = nil
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
if attributes.key?(:'created_at')
|
|
184
|
-
self.created_at = attributes[:'created_at']
|
|
185
|
-
else
|
|
186
|
-
self.created_at = nil
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
if attributes.key?(:'updated_at')
|
|
190
|
-
self.updated_at = attributes[:'updated_at']
|
|
191
|
-
else
|
|
192
|
-
self.updated_at = nil
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
|
197
|
-
# @return Array for valid properties with the reasons
|
|
198
|
-
def list_invalid_properties
|
|
199
|
-
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
200
|
-
invalid_properties = Array.new
|
|
201
|
-
if @public_id.nil?
|
|
202
|
-
invalid_properties.push('invalid value for "public_id", public_id cannot be nil.')
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
if @key.nil?
|
|
206
|
-
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
if @key.to_s.length > 64
|
|
210
|
-
invalid_properties.push('invalid value for "key", the character length must be smaller than or equal to 64.')
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
if @key.to_s.length < 1
|
|
214
|
-
invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
pattern = Regexp.new(/^[a-z0-9][a-z0-9_.-]{0,63}$/)
|
|
218
|
-
if @key !~ pattern
|
|
219
|
-
invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
if @label.nil?
|
|
223
|
-
invalid_properties.push('invalid value for "label", label cannot be nil.')
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
if @label.to_s.length > 80
|
|
227
|
-
invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 80.')
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
if @label.to_s.length < 1
|
|
231
|
-
invalid_properties.push('invalid value for "label", the character length must be great than or equal to 1.')
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
if @currency_code.to_s.length > 3
|
|
235
|
-
invalid_properties.push('invalid value for "currency_code", the character length must be smaller than or equal to 3.')
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
if @currency_code.to_s.length < 3
|
|
239
|
-
invalid_properties.push('invalid value for "currency_code", the character length must be great than or equal to 3.')
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
pattern = Regexp.new(/^[A-Z]{3}$/)
|
|
243
|
-
if @currency_code !~ pattern
|
|
244
|
-
invalid_properties.push("invalid value for \"currency_code\", must conform to the pattern #{pattern}.")
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
if @unit.to_s.length > 16
|
|
248
|
-
invalid_properties.push('invalid value for "unit", the character length must be smaller than or equal to 16.')
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
if @unit_spacing.nil?
|
|
252
|
-
invalid_properties.push('invalid value for "unit_spacing", unit_spacing cannot be nil.')
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
if @format.nil?
|
|
256
|
-
invalid_properties.push('invalid value for "format", format cannot be nil.')
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
if @created_at.nil?
|
|
260
|
-
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
if @updated_at.nil?
|
|
264
|
-
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
invalid_properties
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
# Check to see if the all the properties in the model are valid
|
|
271
|
-
# @return true if the model is valid
|
|
272
|
-
def valid?
|
|
273
|
-
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
274
|
-
return false if @public_id.nil?
|
|
275
|
-
return false if @key.nil?
|
|
276
|
-
return false if @key.to_s.length > 64
|
|
277
|
-
return false if @key.to_s.length < 1
|
|
278
|
-
return false if @key !~ Regexp.new(/^[a-z0-9][a-z0-9_.-]{0,63}$/)
|
|
279
|
-
return false if @label.nil?
|
|
280
|
-
return false if @label.to_s.length > 80
|
|
281
|
-
return false if @label.to_s.length < 1
|
|
282
|
-
return false if @currency_code.to_s.length > 3
|
|
283
|
-
return false if @currency_code.to_s.length < 3
|
|
284
|
-
return false if @currency_code !~ Regexp.new(/^[A-Z]{3}$/)
|
|
285
|
-
return false if @unit.to_s.length > 16
|
|
286
|
-
return false if @unit_spacing.nil?
|
|
287
|
-
return false if @format.nil?
|
|
288
|
-
return false if @created_at.nil?
|
|
289
|
-
return false if @updated_at.nil?
|
|
290
|
-
true
|
|
291
|
-
end
|
|
292
|
-
|
|
293
|
-
# Custom attribute writer method with validation
|
|
294
|
-
# @param [Object] key Value to be assigned
|
|
295
|
-
def key=(key)
|
|
296
|
-
if key.nil?
|
|
297
|
-
fail ArgumentError, 'key cannot be nil'
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
if key.to_s.length > 64
|
|
301
|
-
fail ArgumentError, 'invalid value for "key", the character length must be smaller than or equal to 64.'
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
if key.to_s.length < 1
|
|
305
|
-
fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
pattern = Regexp.new(/^[a-z0-9][a-z0-9_.-]{0,63}$/)
|
|
309
|
-
if key !~ pattern
|
|
310
|
-
fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
@key = key
|
|
314
|
-
end
|
|
315
|
-
|
|
316
|
-
# Custom attribute writer method with validation
|
|
317
|
-
# @param [Object] label Value to be assigned
|
|
318
|
-
def label=(label)
|
|
319
|
-
if label.nil?
|
|
320
|
-
fail ArgumentError, 'label cannot be nil'
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
if label.to_s.length > 80
|
|
324
|
-
fail ArgumentError, 'invalid value for "label", the character length must be smaller than or equal to 80.'
|
|
325
|
-
end
|
|
326
|
-
|
|
327
|
-
if label.to_s.length < 1
|
|
328
|
-
fail ArgumentError, 'invalid value for "label", the character length must be great than or equal to 1.'
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
@label = label
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
# Custom attribute writer method with validation
|
|
335
|
-
# @param [Object] currency_code Value to be assigned
|
|
336
|
-
def currency_code=(currency_code)
|
|
337
|
-
if !currency_code.nil? && currency_code.to_s.length > 3
|
|
338
|
-
fail ArgumentError, 'invalid value for "currency_code", the character length must be smaller than or equal to 3.'
|
|
339
|
-
end
|
|
340
|
-
|
|
341
|
-
if !currency_code.nil? && currency_code.to_s.length < 3
|
|
342
|
-
fail ArgumentError, 'invalid value for "currency_code", the character length must be great than or equal to 3.'
|
|
343
|
-
end
|
|
344
|
-
|
|
345
|
-
pattern = Regexp.new(/^[A-Z]{3}$/)
|
|
346
|
-
if !currency_code.nil? && currency_code !~ pattern
|
|
347
|
-
fail ArgumentError, "invalid value for \"currency_code\", must conform to the pattern #{pattern}."
|
|
348
|
-
end
|
|
349
|
-
|
|
350
|
-
@currency_code = currency_code
|
|
351
|
-
end
|
|
352
|
-
|
|
353
|
-
# Custom attribute writer method with validation
|
|
354
|
-
# @param [Object] unit Value to be assigned
|
|
355
|
-
def unit=(unit)
|
|
356
|
-
if !unit.nil? && unit.to_s.length > 16
|
|
357
|
-
fail ArgumentError, 'invalid value for "unit", the character length must be smaller than or equal to 16.'
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
@unit = unit
|
|
361
|
-
end
|
|
362
|
-
|
|
363
|
-
# Checks equality by comparing each attribute.
|
|
364
|
-
# @param [Object] Object to be compared
|
|
365
|
-
def ==(o)
|
|
366
|
-
return true if self.equal?(o)
|
|
367
|
-
self.class == o.class &&
|
|
368
|
-
public_id == o.public_id &&
|
|
369
|
-
key == o.key &&
|
|
370
|
-
label == o.label &&
|
|
371
|
-
currency_code == o.currency_code &&
|
|
372
|
-
unit == o.unit &&
|
|
373
|
-
unit_spacing == o.unit_spacing &&
|
|
374
|
-
format == o.format &&
|
|
375
|
-
latest_value == o.latest_value &&
|
|
376
|
-
latest_value_at == o.latest_value_at &&
|
|
377
|
-
created_at == o.created_at &&
|
|
378
|
-
updated_at == o.updated_at
|
|
379
|
-
end
|
|
380
|
-
|
|
381
|
-
# @see the `==` method
|
|
382
|
-
# @param [Object] Object to be compared
|
|
383
|
-
def eql?(o)
|
|
384
|
-
self == o
|
|
385
|
-
end
|
|
386
|
-
|
|
387
|
-
# Calculates hash code according to all attributes.
|
|
388
|
-
# @return [Integer] Hash code
|
|
389
|
-
def hash
|
|
390
|
-
[public_id, key, label, currency_code, unit, unit_spacing, format, latest_value, latest_value_at, created_at, updated_at].hash
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
# Builds the object from hash
|
|
394
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
395
|
-
# @return [Object] Returns the model itself
|
|
396
|
-
def self.build_from_hash(attributes)
|
|
397
|
-
return nil unless attributes.is_a?(Hash)
|
|
398
|
-
attributes = attributes.transform_keys(&:to_sym)
|
|
399
|
-
transformed_hash = {}
|
|
400
|
-
openapi_types.each_pair do |key, type|
|
|
401
|
-
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
402
|
-
transformed_hash["#{key}"] = nil
|
|
403
|
-
elsif type =~ /\AArray<(.*)>/i
|
|
404
|
-
# check to ensure the input is an array given that the attribute
|
|
405
|
-
# is documented as an array but the input is not
|
|
406
|
-
if attributes[attribute_map[key]].is_a?(Array)
|
|
407
|
-
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
408
|
-
end
|
|
409
|
-
elsif !attributes[attribute_map[key]].nil?
|
|
410
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
411
|
-
end
|
|
412
|
-
end
|
|
413
|
-
new(transformed_hash)
|
|
414
|
-
end
|
|
415
|
-
|
|
416
|
-
# Deserializes the data based on type
|
|
417
|
-
# @param string type Data type
|
|
418
|
-
# @param string value Value to be deserialized
|
|
419
|
-
# @return [Object] Deserialized data
|
|
420
|
-
def self._deserialize(type, value)
|
|
421
|
-
case type.to_sym
|
|
422
|
-
when :Time
|
|
423
|
-
Time.parse(value)
|
|
424
|
-
when :Date
|
|
425
|
-
Date.parse(value)
|
|
426
|
-
when :String
|
|
427
|
-
value.to_s
|
|
428
|
-
when :Integer
|
|
429
|
-
value.to_i
|
|
430
|
-
when :Float
|
|
431
|
-
value.to_f
|
|
432
|
-
when :Boolean
|
|
433
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
434
|
-
true
|
|
435
|
-
else
|
|
436
|
-
false
|
|
437
|
-
end
|
|
438
|
-
when :Object
|
|
439
|
-
# generic object (usually a Hash), return directly
|
|
440
|
-
value
|
|
441
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
442
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
443
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
444
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
445
|
-
k_type = Regexp.last_match[:k_type]
|
|
446
|
-
v_type = Regexp.last_match[:v_type]
|
|
447
|
-
{}.tap do |hash|
|
|
448
|
-
value.each do |k, v|
|
|
449
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
450
|
-
end
|
|
451
|
-
end
|
|
452
|
-
else # model
|
|
453
|
-
# models (e.g. Pet) or oneOf
|
|
454
|
-
klass = OpenapiClient.const_get(type)
|
|
455
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
456
|
-
end
|
|
457
|
-
end
|
|
458
|
-
|
|
459
|
-
# Returns the string representation of the object
|
|
460
|
-
# @return [String] String presentation of the object
|
|
461
|
-
def to_s
|
|
462
|
-
to_hash.to_s
|
|
463
|
-
end
|
|
464
|
-
|
|
465
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
466
|
-
# @return [Hash] Returns the object in the form of hash
|
|
467
|
-
def to_body
|
|
468
|
-
to_hash
|
|
469
|
-
end
|
|
470
|
-
|
|
471
|
-
# Returns the object in the form of hash
|
|
472
|
-
# @return [Hash] Returns the object in the form of hash
|
|
473
|
-
def to_hash
|
|
474
|
-
hash = {}
|
|
475
|
-
self.class.attribute_map.each_pair do |attr, param|
|
|
476
|
-
value = self.send(attr)
|
|
477
|
-
if value.nil?
|
|
478
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
479
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
480
|
-
end
|
|
481
|
-
|
|
482
|
-
hash[param] = _to_hash(value)
|
|
483
|
-
end
|
|
484
|
-
hash
|
|
485
|
-
end
|
|
486
|
-
|
|
487
|
-
# Outputs non-array value in the form of hash
|
|
488
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
489
|
-
# @param [Object] value Any valid value
|
|
490
|
-
# @return [Hash] Returns the value in the form of hash
|
|
491
|
-
def _to_hash(value)
|
|
492
|
-
if value.is_a?(Array)
|
|
493
|
-
value.compact.map { |v| _to_hash(v) }
|
|
494
|
-
elsif value.is_a?(Hash)
|
|
495
|
-
{}.tap do |hash|
|
|
496
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
497
|
-
end
|
|
498
|
-
elsif value.respond_to? :to_hash
|
|
499
|
-
value.to_hash
|
|
500
|
-
else
|
|
501
|
-
value
|
|
502
|
-
end
|
|
503
|
-
end
|
|
504
|
-
|
|
505
|
-
end
|
|
506
|
-
|
|
507
|
-
end
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#ActivitySmith API
|
|
3
|
-
|
|
4
|
-
#Send push notifications and Live Activities to your own devices via a single API key.
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.0
|
|
7
|
-
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.7.0
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'date'
|
|
14
|
-
require 'time'
|
|
15
|
-
|
|
16
|
-
module OpenapiClient
|
|
17
|
-
# Latest metric value. Numeric formats return a number. String metrics return text.
|
|
18
|
-
module WidgetMetricLatestValue
|
|
19
|
-
class << self
|
|
20
|
-
# List of class defined in anyOf (OpenAPI v3)
|
|
21
|
-
def openapi_any_of
|
|
22
|
-
[
|
|
23
|
-
:'Float',
|
|
24
|
-
:'String'
|
|
25
|
-
]
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Builds the object
|
|
29
|
-
# @param [Mixed] Data to be matched against the list of anyOf items
|
|
30
|
-
# @return [Object] Returns the model or the data itself
|
|
31
|
-
def build(data)
|
|
32
|
-
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
|
33
|
-
# Note:
|
|
34
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
35
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
36
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
37
|
-
# - TODO: logging when debugging is set.
|
|
38
|
-
openapi_any_of.each do |klass|
|
|
39
|
-
begin
|
|
40
|
-
next if klass == :AnyType # "nullable: true"
|
|
41
|
-
typed_data = find_and_cast_into_type(klass, data)
|
|
42
|
-
return typed_data if typed_data
|
|
43
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
openapi_any_of.include?(:AnyType) ? data : nil
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
private
|
|
51
|
-
|
|
52
|
-
SchemaMismatchError = Class.new(StandardError)
|
|
53
|
-
|
|
54
|
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
55
|
-
def find_and_cast_into_type(klass, data)
|
|
56
|
-
return if data.nil?
|
|
57
|
-
|
|
58
|
-
case klass.to_s
|
|
59
|
-
when 'Boolean'
|
|
60
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
61
|
-
when 'Float'
|
|
62
|
-
return data if data.instance_of?(Float)
|
|
63
|
-
when 'Integer'
|
|
64
|
-
return data if data.instance_of?(Integer)
|
|
65
|
-
when 'Time'
|
|
66
|
-
return Time.parse(data)
|
|
67
|
-
when 'Date'
|
|
68
|
-
return Date.parse(data)
|
|
69
|
-
when 'String'
|
|
70
|
-
return data if data.instance_of?(String)
|
|
71
|
-
when 'Object' # "type: object"
|
|
72
|
-
return data if data.instance_of?(Hash)
|
|
73
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
74
|
-
if data.instance_of?(Array)
|
|
75
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
76
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
77
|
-
end
|
|
78
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
79
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
80
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
81
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
82
|
-
end
|
|
83
|
-
else # model
|
|
84
|
-
const = OpenapiClient.const_get(klass)
|
|
85
|
-
if const
|
|
86
|
-
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
|
87
|
-
model = const.build(data)
|
|
88
|
-
return model if model
|
|
89
|
-
else
|
|
90
|
-
# raise if data contains keys that are not known to the model
|
|
91
|
-
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
92
|
-
model = const.build_from_hash(data)
|
|
93
|
-
return model if model
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
raise # if no match by now, raise
|
|
99
|
-
rescue
|
|
100
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
end
|