gecko-ruby 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rubocop.yml +9 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +41 -0
- data/CONTRIBUTING.md +0 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +144 -0
- data/Rakefile +19 -0
- data/gecko-ruby.gemspec +34 -0
- data/generate.thor +81 -0
- data/lib/gecko-ruby.rb +1 -0
- data/lib/gecko.rb +31 -0
- data/lib/gecko/client.rb +132 -0
- data/lib/gecko/helpers/association_helper.rb +69 -0
- data/lib/gecko/helpers/inspection_helper.rb +51 -0
- data/lib/gecko/helpers/record_helper.rb +29 -0
- data/lib/gecko/helpers/serialization_helper.rb +61 -0
- data/lib/gecko/helpers/validation_helper.rb +91 -0
- data/lib/gecko/record/account.rb +66 -0
- data/lib/gecko/record/address.rb +33 -0
- data/lib/gecko/record/base.rb +66 -0
- data/lib/gecko/record/base_adapter.rb +365 -0
- data/lib/gecko/record/company.rb +41 -0
- data/lib/gecko/record/contact.rb +25 -0
- data/lib/gecko/record/currency.rb +23 -0
- data/lib/gecko/record/exceptions.rb +15 -0
- data/lib/gecko/record/fulfillment.rb +42 -0
- data/lib/gecko/record/fulfillment_line_item.rb +26 -0
- data/lib/gecko/record/image.rb +38 -0
- data/lib/gecko/record/invoice.rb +29 -0
- data/lib/gecko/record/invoice_line_item.rb +18 -0
- data/lib/gecko/record/location.rb +23 -0
- data/lib/gecko/record/order.rb +50 -0
- data/lib/gecko/record/order_line_item.rb +35 -0
- data/lib/gecko/record/product.rb +27 -0
- data/lib/gecko/record/purchase_order.rb +43 -0
- data/lib/gecko/record/purchase_order_line_item.rb +29 -0
- data/lib/gecko/record/tax_type.rb +21 -0
- data/lib/gecko/record/user.rb +44 -0
- data/lib/gecko/record/variant.rb +96 -0
- data/lib/gecko/version.rb +3 -0
- data/test/client_test.rb +29 -0
- data/test/fixtures/vcr_cassettes/accounts.yml +57 -0
- data/test/fixtures/vcr_cassettes/accounts_current.yml +57 -0
- data/test/fixtures/vcr_cassettes/addresses.yml +68 -0
- data/test/fixtures/vcr_cassettes/addresses_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/companies.yml +62 -0
- data/test/fixtures/vcr_cassettes/companies_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/contacts.yml +60 -0
- data/test/fixtures/vcr_cassettes/contacts_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/currencies.yml +62 -0
- data/test/fixtures/vcr_cassettes/currencies_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/fulfillments.yml +59 -0
- data/test/fixtures/vcr_cassettes/fulfillments_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/images.yml +59 -0
- data/test/fixtures/vcr_cassettes/images_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/invoice_line_items.yml +63 -0
- data/test/fixtures/vcr_cassettes/invoice_line_items_count.yml +62 -0
- data/test/fixtures/vcr_cassettes/invoices.yml +63 -0
- data/test/fixtures/vcr_cassettes/invoices_count.yml +62 -0
- data/test/fixtures/vcr_cassettes/locations.yml +65 -0
- data/test/fixtures/vcr_cassettes/locations_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/order_line_items.yml +63 -0
- data/test/fixtures/vcr_cassettes/order_line_items_count.yml +62 -0
- data/test/fixtures/vcr_cassettes/orders.yml +62 -0
- data/test/fixtures/vcr_cassettes/orders_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/products.yml +79 -0
- data/test/fixtures/vcr_cassettes/products_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/products_new_invalid.yml +54 -0
- data/test/fixtures/vcr_cassettes/products_new_valid.yml +58 -0
- data/test/fixtures/vcr_cassettes/purchase_order_line_items.yml +64 -0
- data/test/fixtures/vcr_cassettes/purchase_order_line_items_count.yml +62 -0
- data/test/fixtures/vcr_cassettes/purchase_orders.yml +63 -0
- data/test/fixtures/vcr_cassettes/purchase_orders_count.yml +62 -0
- data/test/fixtures/vcr_cassettes/tax_types.yml +74 -0
- data/test/fixtures/vcr_cassettes/tax_types_count.yml +62 -0
- data/test/fixtures/vcr_cassettes/users.yml +60 -0
- data/test/fixtures/vcr_cassettes/users_count.yml +58 -0
- data/test/fixtures/vcr_cassettes/users_current.yml +54 -0
- data/test/fixtures/vcr_cassettes/variants.yml +60 -0
- data/test/fixtures/vcr_cassettes/variants_count.yml +58 -0
- data/test/gecko_test.rb +7 -0
- data/test/helpers/association_helper_test.rb +56 -0
- data/test/helpers/inspection_helper_test.rb +27 -0
- data/test/helpers/serialization_helper_test.rb +30 -0
- data/test/helpers/validation_helper_test.rb +24 -0
- data/test/record/account_adapter_test.rb +43 -0
- data/test/record/address_adapter_test.rb +14 -0
- data/test/record/address_test.rb +18 -0
- data/test/record/company_adapter_test.rb +14 -0
- data/test/record/company_test.rb +18 -0
- data/test/record/contact_adapter_test.rb +14 -0
- data/test/record/contact_test.rb +18 -0
- data/test/record/currency_adapter_test.rb +14 -0
- data/test/record/currency_test.rb +18 -0
- data/test/record/fulfillment_adapter_test.rb +24 -0
- data/test/record/fulfillment_line_item_adapter_test.rb +21 -0
- data/test/record/fulfillment_line_item_test.rb +18 -0
- data/test/record/fulfillment_test.rb +27 -0
- data/test/record/image_adapter_test.rb +14 -0
- data/test/record/image_test.rb +25 -0
- data/test/record/invoice_adapter_test.rb +14 -0
- data/test/record/invoice_line_item_adapter_test.rb +20 -0
- data/test/record/invoice_line_item_test.rb +18 -0
- data/test/record/invoice_test.rb +18 -0
- data/test/record/location_adapter_test.rb +14 -0
- data/test/record/location_test.rb +18 -0
- data/test/record/order_adapter_test.rb +14 -0
- data/test/record/order_line_item_adapter_test.rb +14 -0
- data/test/record/order_line_item_test.rb +18 -0
- data/test/record/order_test.rb +18 -0
- data/test/record/product_adapter_test.rb +32 -0
- data/test/record/product_test.rb +18 -0
- data/test/record/purchase_order_adapter_test.rb +14 -0
- data/test/record/purchase_order_line_item_adapter_test.rb +14 -0
- data/test/record/purchase_order_line_item_test.rb +18 -0
- data/test/record/purchase_order_test.rb +18 -0
- data/test/record/tax_type_adapter_test.rb +14 -0
- data/test/record/tax_type_test.rb +18 -0
- data/test/record/user_adapter_test.rb +27 -0
- data/test/record/user_test.rb +18 -0
- data/test/record/variant_adapter_test.rb +14 -0
- data/test/record/variant_test.rb +44 -0
- data/test/support/let.rb +10 -0
- data/test/support/shared_adapter_examples.rb +159 -0
- data/test/support/shared_record_examples.rb +21 -0
- data/test/support/testing_adapter.rb +11 -0
- data/test/support/vcr_support.rb +7 -0
- data/test/test_helper.rb +21 -0
- metadata +430 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::FulfillmentLineItemTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { 'fulfillment_line_items' }
|
8
|
+
let(:record_class) { Gecko::Record::FulfillmentLineItem }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash('fulfillments', 'fulfillment_line_items').first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::FulfillmentLineItem, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::FulfillmentTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { 'fulfillments' }
|
8
|
+
let(:record_class) { Gecko::Record::Fulfillment }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash('fulfillments', 'fulfillments').first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Fulfillment, @record)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_serialization
|
20
|
+
json_keys = %w(
|
21
|
+
order_id shipping_address_id billing_address_id status exchange_rate
|
22
|
+
delivery_type tracking_number notes tracking_url tracking_company packed_at
|
23
|
+
shipped_at received_at receipt
|
24
|
+
).map(&:to_sym)
|
25
|
+
assert_equal json_keys.sort, @record.as_json[:fulfillment].keys.sort
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::ImageAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.Image }
|
8
|
+
let(:plural_name) { "images" }
|
9
|
+
let(:record_class) { Gecko::Record::Image }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::ImageAdapter, @client.Image)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::ImageTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "images" }
|
8
|
+
let(:record_class) { Gecko::Record::Image }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("images", "images").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Image, @record)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_url
|
20
|
+
@record = record_class.new(client, base_path: "https://example.com", file_name: "Gecko.jpg")
|
21
|
+
assert_equal("https://example.com/Gecko.jpg", @record.url)
|
22
|
+
assert_equal("https://example.com/Gecko.jpg", @record.url(:full))
|
23
|
+
assert_equal("https://example.com/thumbnail_Gecko.jpg", @record.url(:thumbnail))
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::InvoiceAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.Invoice }
|
8
|
+
let(:plural_name) { "invoices" }
|
9
|
+
let(:record_class) { Gecko::Record::Invoice }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::InvoiceAdapter, @client.Invoice)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::InvoiceLineItemAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.InvoiceLineItem }
|
8
|
+
let(:plural_name) { "invoice_line_items" }
|
9
|
+
let(:record_class) { Gecko::Record::InvoiceLineItem }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::InvoiceLineItemAdapter, @client.InvoiceLineItem)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def random_attribute
|
18
|
+
:quantity
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::InvoiceLineItemTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "invoice_line_items" }
|
8
|
+
let(:record_class) { Gecko::Record::InvoiceLineItem }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("invoice_line_items", "invoice_line_items").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::InvoiceLineItem, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::InvoiceTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "invoices" }
|
8
|
+
let(:record_class) { Gecko::Record::Invoice }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("invoices", "invoices").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Invoice, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::LocationAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.Location }
|
8
|
+
let(:plural_name) { 'locations' }
|
9
|
+
let(:record_class) { Gecko::Record::Location }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::LocationAdapter, @client.Location)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::LocationTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { 'locations' }
|
8
|
+
let(:record_class) { Gecko::Record::Location }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash('locations', 'locations').first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Location, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::OrderAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.Order }
|
8
|
+
let(:plural_name) { 'orders' }
|
9
|
+
let(:record_class) { Gecko::Record::Order }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::OrderAdapter, @client.Order)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::OrderLineItemAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.OrderLineItem }
|
8
|
+
let(:plural_name) { 'order_line_items' }
|
9
|
+
let(:record_class) { Gecko::Record::OrderLineItem }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::OrderLineItemAdapter, @client.OrderLineItem)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::OrderLineItemTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { 'order_line_items' }
|
8
|
+
let(:record_class) { Gecko::Record::OrderLineItem }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash('order_line_items', 'order_line_items').first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::OrderLineItem, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::OrderTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { 'orders' }
|
8
|
+
let(:record_class) { Gecko::Record::Order }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash('orders', 'orders').first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Order, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::ProductAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.Product }
|
8
|
+
let(:plural_name) { 'products' }
|
9
|
+
let(:record_class) { Gecko::Record::Product }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::ProductAdapter, @client.Product)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_saves_new_record
|
16
|
+
VCR.use_cassette(plural_name + '_new_valid') do
|
17
|
+
record = adapter.build(name: 'Gary')
|
18
|
+
assert record.save
|
19
|
+
assert record.id
|
20
|
+
assert adapter.has_record_for_id?(record.id)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_invalid_new_record
|
25
|
+
VCR.use_cassette(plural_name + '_new_invalid') do
|
26
|
+
record = adapter.build(product_type: 'Gecko')
|
27
|
+
assert !record.save
|
28
|
+
assert !record.id
|
29
|
+
assert_equal record.errors[:name], ["can't be blank"]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::ProductTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { 'products' }
|
8
|
+
let(:record_class) { Gecko::Record::Product }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash('products', 'products').first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Product, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::PurchaseOrderAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.PurchaseOrder }
|
8
|
+
let(:plural_name) { "purchase_orders" }
|
9
|
+
let(:record_class) { Gecko::Record::PurchaseOrder }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::PurchaseOrderAdapter, @client.PurchaseOrder)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::PurchaseOrderLineItemAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.PurchaseOrderLineItem }
|
8
|
+
let(:plural_name) { "purchase_order_line_items" }
|
9
|
+
let(:record_class) { Gecko::Record::PurchaseOrderLineItem }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::PurchaseOrderLineItemAdapter, @client.PurchaseOrderLineItem)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::PurchaseOrderLineItemTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "purchase_order_line_items" }
|
8
|
+
let(:record_class) { Gecko::Record::PurchaseOrderLineItem }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("purchase_order_line_items", "purchase_order_line_items").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::PurchaseOrderLineItem, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::PurchaseOrderTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "purchase_orders" }
|
8
|
+
let(:record_class) { Gecko::Record::PurchaseOrder }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("purchase_orders", "purchase_orders").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::PurchaseOrder, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::TaxTypeAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.TaxType }
|
8
|
+
let(:plural_name) { "tax_types" }
|
9
|
+
let(:record_class) { Gecko::Record::TaxType }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::TaxTypeAdapter, @client.TaxType)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::TaxTypeTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "tax_types" }
|
8
|
+
let(:record_class) { Gecko::Record::TaxType }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("tax_types", "tax_types").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::TaxType, @record)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::Record::UserAdapterTest < Minitest::Test
|
4
|
+
include TestingAdapter
|
5
|
+
include SharedAdapterExamples
|
6
|
+
|
7
|
+
let(:adapter) { @client.User }
|
8
|
+
let(:plural_name) { 'users' }
|
9
|
+
let(:record_class) { Gecko::Record::User }
|
10
|
+
|
11
|
+
def test_initializes_adapter
|
12
|
+
assert_instance_of(Gecko::Record::UserAdapter, @client.User)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Can't build users via API
|
16
|
+
undef :test_build
|
17
|
+
undef :test_build_with_attributes
|
18
|
+
undef :test_saving_new_record
|
19
|
+
undef :test_saving_new_invalid_record
|
20
|
+
|
21
|
+
def test_current
|
22
|
+
VCR.use_cassette('users#current') do
|
23
|
+
assert_instance_of(Gecko::Record::User, @client.User.current)
|
24
|
+
assert(@client.User.current, 'User.current is identity mapped')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|