runapi-core 0.5.0 → 0.5.2
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/lib/runapi/core/resource_helpers.rb +4 -2
- data/lib/runapi/core/types.rb +5 -18
- data/lib/runapi/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3716e984b8648825f23f5dba6a64e015ff70bf1c1f5711f96f0c41f57f8184f9
|
|
4
|
+
data.tar.gz: cbe52d93ce9609dd55da08d45bba595c8f95cebd80c24db7774a9be0765c3fb8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9499a9cc754db6ff4eaca48fb10f34216adee0beda90582724c0030c0caa486ee93effcbe8e04cab95fd3d3d253639f454b102b786019b27d085767df2d8f0ad
|
|
7
|
+
data.tar.gz: 644da423fc25d2eabb33d974012f18f46aa8f445efa34e901e9e3587107afdf37c43af091e8b82f2672c8538d4f4a8896a9df29c668762341fd7f697f702909a
|
|
@@ -170,7 +170,9 @@ module RunApi
|
|
|
170
170
|
conditions = rule["when"] || {}
|
|
171
171
|
return unless conditions.all? { |field, condition| rule_condition_met?(params, field, condition) }
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
# Sorted so the message matches every other SDK; Go maps have no declaration order.
|
|
174
|
+
context = conditions.sort_by { |field, _| field.to_s }
|
|
175
|
+
.map { |field, condition| rule_condition_label(field, condition) }.join(" and ")
|
|
174
176
|
qualifier = context.empty? ? "" : " when #{context}"
|
|
175
177
|
|
|
176
178
|
Array(rule["required"]).each do |field|
|
|
@@ -190,7 +192,7 @@ module RunApi
|
|
|
190
192
|
raise Core::ValidationError, "#{field} is not allowed#{qualifier}"
|
|
191
193
|
end
|
|
192
194
|
|
|
193
|
-
(rule["enum"] || {}).each do |field, allowed|
|
|
195
|
+
(rule["enum"] || {}).sort_by { |field, _| field.to_s }.each do |field, allowed|
|
|
194
196
|
next unless field_present?(params, field)
|
|
195
197
|
|
|
196
198
|
value = param_value(params, field)
|
data/lib/runapi/core/types.rb
CHANGED
|
@@ -101,23 +101,8 @@ module RunApi
|
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
class
|
|
105
|
-
required :
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
class TaskSettlement < BaseModel
|
|
109
|
-
required :charged_amount_cents, Numeric
|
|
110
|
-
required :amount_micro_cents, Numeric
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
class TaskRefund < BaseModel
|
|
114
|
-
required :refunded_at, String
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
class TaskBillingFacts < BaseModel
|
|
118
|
-
optional :reservation, TaskReservation
|
|
119
|
-
optional :settlement, TaskSettlement
|
|
120
|
-
optional :refund, TaskRefund
|
|
104
|
+
class TaskUsage < BaseModel
|
|
105
|
+
required :cost, Numeric
|
|
121
106
|
end
|
|
122
107
|
|
|
123
108
|
# Typed response structure for async task operations.
|
|
@@ -129,6 +114,8 @@ module RunApi
|
|
|
129
114
|
# @return [String, nil] Current task status.
|
|
130
115
|
# @!attribute [r] error
|
|
131
116
|
# @return [String, nil] Error message if task failed.
|
|
117
|
+
# @!attribute [r] usage
|
|
118
|
+
# @return [TaskUsage, nil] Settled cost in USD on completed Task envelopes.
|
|
132
119
|
class TaskResponse < BaseModel
|
|
133
120
|
module Status
|
|
134
121
|
PENDING = "pending"
|
|
@@ -142,7 +129,7 @@ module RunApi
|
|
|
142
129
|
optional :id, String
|
|
143
130
|
optional :status, String
|
|
144
131
|
optional :error, String
|
|
145
|
-
optional :
|
|
132
|
+
optional :usage, TaskUsage
|
|
146
133
|
end
|
|
147
134
|
end
|
|
148
135
|
end
|
data/lib/runapi/core/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
87
|
version: '0'
|
|
88
88
|
requirements: []
|
|
89
|
-
rubygems_version: 4.0.
|
|
89
|
+
rubygems_version: 4.0.10
|
|
90
90
|
specification_version: 4
|
|
91
91
|
summary: RunAPI Core Ruby SDK
|
|
92
92
|
test_files: []
|