Skip to content

Commit 5c50f4d

Browse files
authored
Add created_at on order response (#44)
1 parent 4dc0c0e commit 5c50f4d

File tree

7 files changed

+22
-5
lines changed

7 files changed

+22
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.12.0] - 2021-09-08
9+
10+
### Added
11+
12+
- Adds a `created_at` attribute in all order responses
13+
814
## [1.11.1] - 2021-09-07
915

1016
### Changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
patch_ruby (1.11.1)
4+
patch_ruby (1.12.0)
55
typhoeus (~> 1.0, >= 1.0.1)
66

77
GEM

lib/patch_ruby/api_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ApiClient
3131
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
3232
def initialize(config = Configuration.default)
3333
@config = config
34-
@user_agent = "patch-ruby/1.11.1"
34+
@user_agent = "patch-ruby/1.12.0"
3535
@default_headers = {
3636
'Content-Type' => 'application/json',
3737
'User-Agent' => @user_agent

lib/patch_ruby/models/create_bitcoin_estimate_request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def self.acceptable_attributes
4141
# Attribute type mapping.
4242
def self.openapi_types
4343
{
44-
:'timestamp' => :'String',
44+
:'timestamp' => :'Time',
4545
:'transaction_value_btc_sats' => :'Integer',
4646
:'project_id' => :'String',
4747
:'create_order' => :'Boolean'

lib/patch_ruby/models/order.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class Order
1818
# A unique uid for the record. UIDs will be prepended by ord_prod or ord_test depending on the mode it was created in.
1919
attr_accessor :id
2020

21+
# The timestamp at which the order was created
22+
attr_accessor :created_at
23+
2124
# The amount of carbon offsets in grams purchased through this order.
2225
attr_accessor :mass_g
2326

@@ -71,6 +74,7 @@ def valid?(value)
7174
def self.attribute_map
7275
{
7376
:'id' => :'id',
77+
:'created_at' => :'created_at',
7478
:'mass_g' => :'mass_g',
7579
:'production' => :'production',
7680
:'state' => :'state',
@@ -92,6 +96,7 @@ def self.acceptable_attributes
9296
def self.openapi_types
9397
{
9498
:'id' => :'String',
99+
:'created_at' => :'Time',
95100
:'mass_g' => :'Integer',
96101
:'production' => :'Boolean',
97102
:'state' => :'String',
@@ -143,6 +148,10 @@ def initialize(attributes = {})
143148
self.id = attributes[:'id']
144149
end
145150

151+
if attributes.key?(:'created_at')
152+
self.created_at = attributes[:'created_at']
153+
end
154+
146155
if attributes.key?(:'mass_g')
147156
self.mass_g = attributes[:'mass_g']
148157
end
@@ -288,6 +297,7 @@ def ==(o)
288297
return true if self.equal?(o)
289298
self.class == o.class &&
290299
id == o.id &&
300+
created_at == o.created_at &&
291301
mass_g == o.mass_g &&
292302
production == o.production &&
293303
state == o.state &&
@@ -308,7 +318,7 @@ def eql?(o)
308318
# Calculates hash code according to all attributes.
309319
# @return [Integer] Hash code
310320
def hash
311-
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
321+
[id, created_at, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
312322
end
313323

314324
# Builds the object from hash

lib/patch_ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
=end
1212

1313
module Patch
14-
VERSION = '1.11.1'
14+
VERSION = '1.12.0'
1515
end

spec/integration/orders_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
order = create_order_response.data
3838
expect(create_order_response.success).to eq true
3939
expect(order.id).not_to be_nil
40+
expect(order.created_at).to be_a_kind_of(Time)
4041
expect(order.mass_g).to eq(order_mass_g)
4142
expect(order.price_cents_usd).to be_between(expected_price - 2, expected_price + 2)
4243
expect(order.patch_fee_cents_usd).to be_kind_of(Integer)

0 commit comments

Comments
 (0)