Skip to content

Commit

Permalink
Add created_at on order response (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcothenet authored Sep 8, 2021
1 parent 4dc0c0e commit 5c50f4d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.12.0] - 2021-09-08

### Added

- Adds a `created_at` attribute in all order responses

## [1.11.1] - 2021-09-07

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
patch_ruby (1.11.1)
patch_ruby (1.12.0)
typhoeus (~> 1.0, >= 1.0.1)

GEM
Expand Down
2 changes: 1 addition & 1 deletion lib/patch_ruby/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiClient
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
def initialize(config = Configuration.default)
@config = config
@user_agent = "patch-ruby/1.11.1"
@user_agent = "patch-ruby/1.12.0"
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
Expand Down
2 changes: 1 addition & 1 deletion lib/patch_ruby/models/create_bitcoin_estimate_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
:'timestamp' => :'String',
:'timestamp' => :'Time',
:'transaction_value_btc_sats' => :'Integer',
:'project_id' => :'String',
:'create_order' => :'Boolean'
Expand Down
12 changes: 11 additions & 1 deletion lib/patch_ruby/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class Order
# A unique uid for the record. UIDs will be prepended by ord_prod or ord_test depending on the mode it was created in.
attr_accessor :id

# The timestamp at which the order was created
attr_accessor :created_at

# The amount of carbon offsets in grams purchased through this order.
attr_accessor :mass_g

Expand Down Expand Up @@ -71,6 +74,7 @@ def valid?(value)
def self.attribute_map
{
:'id' => :'id',
:'created_at' => :'created_at',
:'mass_g' => :'mass_g',
:'production' => :'production',
:'state' => :'state',
Expand All @@ -92,6 +96,7 @@ def self.acceptable_attributes
def self.openapi_types
{
:'id' => :'String',
:'created_at' => :'Time',
:'mass_g' => :'Integer',
:'production' => :'Boolean',
:'state' => :'String',
Expand Down Expand Up @@ -143,6 +148,10 @@ def initialize(attributes = {})
self.id = attributes[:'id']
end

if attributes.key?(:'created_at')
self.created_at = attributes[:'created_at']
end

if attributes.key?(:'mass_g')
self.mass_g = attributes[:'mass_g']
end
Expand Down Expand Up @@ -288,6 +297,7 @@ def ==(o)
return true if self.equal?(o)
self.class == o.class &&
id == o.id &&
created_at == o.created_at &&
mass_g == o.mass_g &&
production == o.production &&
state == o.state &&
Expand All @@ -308,7 +318,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[id, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
[id, created_at, mass_g, production, state, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata].hash
end

# Builds the object from hash
Expand Down
2 changes: 1 addition & 1 deletion lib/patch_ruby/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module Patch
VERSION = '1.11.1'
VERSION = '1.12.0'
end
1 change: 1 addition & 0 deletions spec/integration/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
order = create_order_response.data
expect(create_order_response.success).to eq true
expect(order.id).not_to be_nil
expect(order.created_at).to be_a_kind_of(Time)
expect(order.mass_g).to eq(order_mass_g)
expect(order.price_cents_usd).to be_between(expected_price - 2, expected_price + 2)
expect(order.patch_fee_cents_usd).to be_kind_of(Integer)
Expand Down

0 comments on commit 5c50f4d

Please sign in to comment.