From 5c50f4d72f86cfb10301dd80c81772841774e0f8 Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Wed, 8 Sep 2021 14:52:10 -0700 Subject: [PATCH] Add created_at on order response (#44) --- CHANGELOG.md | 6 ++++++ Gemfile.lock | 2 +- lib/patch_ruby/api_client.rb | 2 +- .../models/create_bitcoin_estimate_request.rb | 2 +- lib/patch_ruby/models/order.rb | 12 +++++++++++- lib/patch_ruby/version.rb | 2 +- spec/integration/orders_spec.rb | 1 + 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac5eeda..2f08ef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 1dd90d1..be5ae2b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - patch_ruby (1.11.1) + patch_ruby (1.12.0) typhoeus (~> 1.0, >= 1.0.1) GEM diff --git a/lib/patch_ruby/api_client.rb b/lib/patch_ruby/api_client.rb index 3ddd410..274e87c 100644 --- a/lib/patch_ruby/api_client.rb +++ b/lib/patch_ruby/api_client.rb @@ -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 diff --git a/lib/patch_ruby/models/create_bitcoin_estimate_request.rb b/lib/patch_ruby/models/create_bitcoin_estimate_request.rb index 6dbc564..1af89f1 100644 --- a/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +++ b/lib/patch_ruby/models/create_bitcoin_estimate_request.rb @@ -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' diff --git a/lib/patch_ruby/models/order.rb b/lib/patch_ruby/models/order.rb index 5cc67a4..d746ac5 100644 --- a/lib/patch_ruby/models/order.rb +++ b/lib/patch_ruby/models/order.rb @@ -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 @@ -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', @@ -92,6 +96,7 @@ def self.acceptable_attributes def self.openapi_types { :'id' => :'String', + :'created_at' => :'Time', :'mass_g' => :'Integer', :'production' => :'Boolean', :'state' => :'String', @@ -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 @@ -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 && @@ -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 diff --git a/lib/patch_ruby/version.rb b/lib/patch_ruby/version.rb index 6713fb9..5136657 100644 --- a/lib/patch_ruby/version.rb +++ b/lib/patch_ruby/version.rb @@ -11,5 +11,5 @@ =end module Patch - VERSION = '1.11.1' + VERSION = '1.12.0' end diff --git a/spec/integration/orders_spec.rb b/spec/integration/orders_spec.rb index 0ebf711..8e6010f 100644 --- a/spec/integration/orders_spec.rb +++ b/spec/integration/orders_spec.rb @@ -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)