gecko-ruby 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/gecko.rb +1 -0
- data/lib/gecko/client.rb +1 -0
- data/lib/gecko/record/variant.rb +3 -1
- data/lib/gecko/record/webhook.rb +39 -0
- data/lib/gecko/version.rb +1 -1
- data/test/fixtures/vcr_cassettes/webhooks.yml +63 -0
- data/test/record/webhook_test.rb +18 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8e082fc40364a9d721e8fa1b424aa57145802d8a53d89cbc9fd64336f8f6697
|
4
|
+
data.tar.gz: e1e45018bb0fd9bc07cd6c847e603d9d8960f52293f12b706715d4a88fe52a01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b22adef292766164e6adc9a84f2ca2dcf81b8e0cc288682dd86cf8c6972a1bc29d8f0701c1d3c90ce4e1bd6e06c3bd79b1c7d90ee57015585de02a82e8aec3d
|
7
|
+
data.tar.gz: 06fcc472d0834dcf49249ea735d70f9b9dcccb5959b96a6fd4e41544d708b238fbdd699bab493b719f920871a3f5f980e194b249bd703242f36b33c761cfc909
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.6.0 (2018-11-13)
|
2
|
+
- Add `Gecko::Record::Webhook` model.
|
3
|
+
- Expose new `available` attribute on a Variant#VariantLocation model, this should remove the need to calculate available stock on the client.
|
4
|
+
|
1
5
|
## 0.5.0 (2018-08-15)
|
2
6
|
- [BREAKING CHANGE] has_many associations now return an enumerable
|
3
7
|
`CollectionProxy` where they used to return a plain array.
|
data/lib/gecko.rb
CHANGED
data/lib/gecko/client.rb
CHANGED
data/lib/gecko/record/variant.rb
CHANGED
@@ -7,9 +7,11 @@ module Gecko
|
|
7
7
|
include Virtus.model
|
8
8
|
include Gecko::Helpers::SerializationHelper
|
9
9
|
attribute :location_id, Integer
|
10
|
+
attribute :available, BigDecimal
|
11
|
+
attribute :bin_location, String
|
12
|
+
|
10
13
|
attribute :committed, BigDecimal
|
11
14
|
attribute :stock_on_hand, BigDecimal
|
12
|
-
attribute :bin_location, String
|
13
15
|
|
14
16
|
alias_method :committed_stock, :committed
|
15
17
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'gecko/record/base'
|
2
|
+
|
3
|
+
module Gecko
|
4
|
+
module Record
|
5
|
+
class Webhook < Base
|
6
|
+
EVENTS = %w[
|
7
|
+
address.create
|
8
|
+
address.update
|
9
|
+
company.create
|
10
|
+
company.update
|
11
|
+
contact.create
|
12
|
+
contact.update
|
13
|
+
fulfillment.create
|
14
|
+
fulfillment.fulfilled
|
15
|
+
fulfillment_return.create
|
16
|
+
image.create
|
17
|
+
invoice.create
|
18
|
+
location.create
|
19
|
+
location.update
|
20
|
+
order.create
|
21
|
+
order.finalized
|
22
|
+
order.fulfilled
|
23
|
+
payment.create
|
24
|
+
procurement.create
|
25
|
+
product.create
|
26
|
+
purchase_order.create
|
27
|
+
stock_adjustment.create
|
28
|
+
stock_transfer.create
|
29
|
+
variant.create
|
30
|
+
]
|
31
|
+
|
32
|
+
attribute :address, String
|
33
|
+
attribute :event, String
|
34
|
+
end
|
35
|
+
|
36
|
+
class WebhookAdapter < BaseAdapter
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/gecko/version.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.lvh.me:3000/webhooks?limit=5
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Gecko/0.0.3 OAuth2/1.0.0 Faraday/0.9.0 Ruby/2.0.0
|
12
|
+
Authorization:
|
13
|
+
- Bearer d7ebf96f5550d6ffc05474c4da3ce9d8e408ca2540ee0bbcb9e2140d47e64963
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: 'OK '
|
22
|
+
headers:
|
23
|
+
X-Frame-Options:
|
24
|
+
- SAMEORIGIN
|
25
|
+
X-Xss-Protection:
|
26
|
+
- 1; mode=block
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
29
|
+
X-Rate-Limit-Limit:
|
30
|
+
- '300'
|
31
|
+
X-Rate-Limit-Remaining:
|
32
|
+
- '299'
|
33
|
+
X-Rate-Limit-Reset:
|
34
|
+
- '1412078700'
|
35
|
+
X-Pagination:
|
36
|
+
- '{"total_records":11,"total_pages":3,"first_page":true,"last_page":false,"out_of_bounds":false,"offset":0}'
|
37
|
+
Link:
|
38
|
+
- <http://api.lvh.me:3000/ajax/webhooks?limit=5&page=2>; rel="next", <http://api.lvh.me:3000/ajax/webhooks?limit=5&page=3>;
|
39
|
+
rel="last"
|
40
|
+
Content-Type:
|
41
|
+
- application/json; charset=utf-8
|
42
|
+
Etag:
|
43
|
+
- '"8764f347b32f518a0e47d3c94dba94c8"'
|
44
|
+
Cache-Control:
|
45
|
+
- max-age=0, private, must-revalidate
|
46
|
+
X-Request-Id:
|
47
|
+
- d4776b8b-1c61-4cf2-9830-ff0334799ca4
|
48
|
+
X-Runtime:
|
49
|
+
- '1.611920'
|
50
|
+
Server:
|
51
|
+
- WEBrick/1.3.1 (Ruby/2.0.0/2014-05-08)
|
52
|
+
Date:
|
53
|
+
- Tue, 30 Sep 2014 12:02:19 GMT
|
54
|
+
Content-Length:
|
55
|
+
- '1751'
|
56
|
+
Connection:
|
57
|
+
- Keep-Alive
|
58
|
+
body:
|
59
|
+
encoding: UTF-8
|
60
|
+
string: '{"webhooks":[{"id":11,"created_at":"2018-09-24T11:12:49.244Z","updated_at":"2018-09-24T11:12:49.244Z","event":"product.create","address":"https://aaaa.com/webhooks","oauth_application_id":24}]}'
|
61
|
+
http_version:
|
62
|
+
recorded_at: Tue, 30 Sep 2014 12:02:19 GMT
|
63
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Gecko::WebhookTest < Minitest::Test
|
4
|
+
include VCRHelper
|
5
|
+
include SharedRecordExamples
|
6
|
+
|
7
|
+
let(:plural_name) { "webhooks" }
|
8
|
+
let(:record_class) { Gecko::Record::Webhook }
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@json = load_vcr_hash("webhooks", "webhooks").first
|
12
|
+
@record = record_class.new(client, @json)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_initializes_record
|
16
|
+
assert_instance_of(Gecko::Record::Webhook, @record)
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gecko-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley Priest
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -242,6 +242,7 @@ files:
|
|
242
242
|
- lib/gecko/record/tax_type.rb
|
243
243
|
- lib/gecko/record/user.rb
|
244
244
|
- lib/gecko/record/variant.rb
|
245
|
+
- lib/gecko/record/webhook.rb
|
245
246
|
- lib/gecko/version.rb
|
246
247
|
- test/client_test.rb
|
247
248
|
- test/fixtures/vcr_cassettes/accounts.yml
|
@@ -286,6 +287,7 @@ files:
|
|
286
287
|
- test/fixtures/vcr_cassettes/users_current.yml
|
287
288
|
- test/fixtures/vcr_cassettes/variants.yml
|
288
289
|
- test/fixtures/vcr_cassettes/variants_count.yml
|
290
|
+
- test/fixtures/vcr_cassettes/webhooks.yml
|
289
291
|
- test/gecko_test.rb
|
290
292
|
- test/helpers/association_helper_test.rb
|
291
293
|
- test/helpers/inspection_helper_test.rb
|
@@ -330,6 +332,7 @@ files:
|
|
330
332
|
- test/record/user_test.rb
|
331
333
|
- test/record/variant_adapter_test.rb
|
332
334
|
- test/record/variant_test.rb
|
335
|
+
- test/record/webhook_test.rb
|
333
336
|
- test/support/let.rb
|
334
337
|
- test/support/shared_adapter_examples.rb
|
335
338
|
- test/support/shared_record_examples.rb
|
@@ -405,6 +408,7 @@ test_files:
|
|
405
408
|
- test/fixtures/vcr_cassettes/users_current.yml
|
406
409
|
- test/fixtures/vcr_cassettes/variants.yml
|
407
410
|
- test/fixtures/vcr_cassettes/variants_count.yml
|
411
|
+
- test/fixtures/vcr_cassettes/webhooks.yml
|
408
412
|
- test/gecko_test.rb
|
409
413
|
- test/helpers/association_helper_test.rb
|
410
414
|
- test/helpers/inspection_helper_test.rb
|
@@ -449,6 +453,7 @@ test_files:
|
|
449
453
|
- test/record/user_test.rb
|
450
454
|
- test/record/variant_adapter_test.rb
|
451
455
|
- test/record/variant_test.rb
|
456
|
+
- test/record/webhook_test.rb
|
452
457
|
- test/support/let.rb
|
453
458
|
- test/support/shared_adapter_examples.rb
|
454
459
|
- test/support/shared_record_examples.rb
|