gecko-ruby 0.0.10 → 0.1.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/client.rb +2 -2
- data/lib/gecko/record/account.rb +25 -26
- data/lib/gecko/record/company.rb +9 -6
- data/lib/gecko/record/contact.rb +3 -1
- data/lib/gecko/record/fulfillment.rb +1 -0
- data/lib/gecko/record/image.rb +2 -2
- data/lib/gecko/record/invoice.rb +0 -2
- data/lib/gecko/record/invoice_line_item.rb +2 -1
- data/lib/gecko/record/order.rb +5 -1
- data/lib/gecko/record/purchase_order.rb +8 -11
- data/lib/gecko/record/purchase_order_line_item.rb +3 -3
- data/lib/gecko/record/tax_type.rb +0 -2
- data/lib/gecko/record/user.rb +10 -7
- data/lib/gecko/version.rb +1 -1
- data/test/record/fulfillment_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08f0ea519c51017bd91d6d4a2345c1610213a2f8
|
4
|
+
data.tar.gz: d3ec91d7ece3d1099d76b3f1de88f98be1e16505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ff2a4ed0decd8212e1c91a50fb9bfc4c9b256f21a77fce2008137172884d40e0fcf64dc1b5039f32e6d9005f335c4fed534ebca84d3aaa62cc7fc62fbd4fd1e
|
7
|
+
data.tar.gz: c07e8454750c183de6a4af0a9b88ea74b69cc1986ea2974d65f6f7d2867c8dfa1c4621fce172e58b25baeea36b9ce06196171402f65f4a1dc92dc850d5300dca
|
data/CHANGELOG.md
CHANGED
data/lib/gecko/client.rb
CHANGED
@@ -115,13 +115,13 @@ module Gecko
|
|
115
115
|
site: 'https://api.tradegecko.com',
|
116
116
|
authorize_url: 'https://go.tradegecko.com/oauth/authorize',
|
117
117
|
connection_opts: {
|
118
|
-
headers: default_headers
|
118
|
+
headers: self.class.default_headers
|
119
119
|
}
|
120
120
|
}
|
121
121
|
@oauth_client = OAuth2::Client.new(client_id, client_secret, defaults.merge(options))
|
122
122
|
end
|
123
123
|
|
124
|
-
def default_headers
|
124
|
+
def self.default_headers
|
125
125
|
{
|
126
126
|
'User-Agent' => ["Gecko/#{Gecko::VERSION}",
|
127
127
|
"OAuth2/#{OAuth2::Version.to_s}",
|
data/lib/gecko/record/account.rb
CHANGED
@@ -6,6 +6,26 @@ module Gecko
|
|
6
6
|
has_many :users
|
7
7
|
has_many :locations
|
8
8
|
|
9
|
+
belongs_to :primary_location, class_name: "Location"
|
10
|
+
belongs_to :primary_billing_location, class_name: "Location"
|
11
|
+
belongs_to :default_currency, class_name: "Currency"
|
12
|
+
belongs_to :default_payment_term, class_name: "PaymentTerm"
|
13
|
+
belongs_to :billing_contact, class_name: "User"
|
14
|
+
belongs_to :default_sales_order_tax_type, class_name: "TaxType"
|
15
|
+
belongs_to :default_purchase_order_tax_type, class_name: "TaxType"
|
16
|
+
belongs_to :default_tax_exempt, class_name: "TaxType"
|
17
|
+
|
18
|
+
# belongs_to :default_order_price_list, class_name: "PriceList"
|
19
|
+
attribute :default_order_price_list_id, String
|
20
|
+
# belongs_to :default_purchase_order_price_list, class_name: "PriceList"
|
21
|
+
attribute :default_purchase_order_price_list_id, String
|
22
|
+
attribute :default_sales_ledger_account_on, String
|
23
|
+
attribute :default_tax_treatment, String
|
24
|
+
|
25
|
+
attribute :contact_email, String
|
26
|
+
attribute :contact_mobile, String
|
27
|
+
attribute :contact_phone, String
|
28
|
+
|
9
29
|
attribute :name, String
|
10
30
|
attribute :industry, String
|
11
31
|
attribute :logo_url, String, readonly: true
|
@@ -14,35 +34,14 @@ module Gecko
|
|
14
34
|
attribute :country, String
|
15
35
|
attribute :time_zone, String
|
16
36
|
|
17
|
-
attribute :contact_email, String
|
18
|
-
attribute :contact_mobile, String
|
19
|
-
attribute :contact_phone, String
|
20
|
-
|
21
|
-
attribute :invoice_details, String
|
22
|
-
attribute :order_details, String
|
23
|
-
attribute :quote_details, String
|
24
|
-
|
25
|
-
attribute :default_tax_rate, String
|
26
|
-
|
27
|
-
|
28
|
-
attribute :tax_number_label, String
|
29
37
|
attribute :tax_label, String
|
30
|
-
|
31
|
-
belongs_to :billing_contact, class_name: "User"
|
32
|
-
belongs_to :primary_location, class_name: "Location"
|
33
|
-
belongs_to :primary_billing_location, class_name: "Location"
|
34
|
-
belongs_to :default_tax_type, class_name: "TaxType"
|
35
|
-
belongs_to :default_payment_term, class_name: "PaymentTerm"
|
36
|
-
|
37
|
-
# belongs_to :default_currency, class_name: "Currency"
|
38
|
-
# belongs_to :default_purchase_order_price_list, class_name: "PriceList"
|
39
|
-
# belongs_to :default_order_price_list, class_name: "PriceList"
|
38
|
+
attribute :tax_number_label, String
|
40
39
|
|
41
40
|
# attribute :stock_level_warn, String
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# attribute :
|
41
|
+
|
42
|
+
## DEPRECATED
|
43
|
+
attribute :default_tax_rate, String
|
44
|
+
# attribute :default_tax_type, String
|
46
45
|
end
|
47
46
|
|
48
47
|
class AccountAdapter < BaseAdapter
|
data/lib/gecko/record/company.rb
CHANGED
@@ -3,9 +3,14 @@ require 'gecko/record/base'
|
|
3
3
|
module Gecko
|
4
4
|
module Record
|
5
5
|
class Company < Base
|
6
|
-
belongs_to :assignee,
|
7
|
-
belongs_to :default_tax_type,
|
8
|
-
belongs_to :default_payment_term,
|
6
|
+
belongs_to :assignee, class_name: "User"
|
7
|
+
belongs_to :default_tax_type, class_name: "TaxType"
|
8
|
+
belongs_to :default_payment_term, class_name: "PaymentTerm"
|
9
|
+
belongs_to :default_stock_location, class_name: "Location"
|
10
|
+
# belongs_to :default_price_list, class_name: "PriceList"
|
11
|
+
attribute :default_price_list_id, String
|
12
|
+
# belongs_to :default_ledger_account
|
13
|
+
attribute :default_ledger_account_id, Integer
|
9
14
|
|
10
15
|
has_many :addresses
|
11
16
|
has_many :contacts
|
@@ -20,14 +25,12 @@ module Gecko
|
|
20
25
|
attribute :website, String
|
21
26
|
attribute :company_type, String
|
22
27
|
|
23
|
-
attribute :status, String
|
28
|
+
attribute :status, String
|
24
29
|
|
25
30
|
attribute :tax_number, String
|
26
31
|
|
27
32
|
attribute :default_tax_rate, BigDecimal
|
28
33
|
attribute :default_discount_rate, BigDecimal
|
29
|
-
|
30
|
-
# belongs_to :default_price_list, class_name: "PriceList"
|
31
34
|
end
|
32
35
|
|
33
36
|
class CompanyAdapter < BaseAdapter
|
data/lib/gecko/record/contact.rb
CHANGED
@@ -14,9 +14,11 @@ module Gecko
|
|
14
14
|
attribute :phone_number, String
|
15
15
|
attribute :fax, String
|
16
16
|
attribute :position, String
|
17
|
-
attribute :phone, String
|
18
17
|
|
19
18
|
attribute :status, String, readonly: true
|
19
|
+
|
20
|
+
## DEPRECATED
|
21
|
+
attribute :phone, String
|
20
22
|
end
|
21
23
|
|
22
24
|
class ContactAdapter < BaseAdapter
|
data/lib/gecko/record/image.rb
CHANGED
@@ -6,10 +6,10 @@ module Gecko
|
|
6
6
|
AVAILABLE_SIZES = [:full, :thumbnail]
|
7
7
|
|
8
8
|
belongs_to :variant
|
9
|
-
belongs_to :uploader, class_name: "User"
|
9
|
+
belongs_to :uploader, class_name: "User", readonly: true
|
10
10
|
attribute :name, String
|
11
11
|
attribute :url, String
|
12
|
-
attribute :position, Integer
|
12
|
+
attribute :position, Integer, readonly: true
|
13
13
|
attribute :base_path, String, readonly: true
|
14
14
|
attribute :file_name, String, readonly: true
|
15
15
|
attribute :versions, Array[String], readonly: true
|
data/lib/gecko/record/invoice.rb
CHANGED
@@ -18,8 +18,6 @@ module Gecko
|
|
18
18
|
|
19
19
|
attribute :destination_url, String, readonly: true
|
20
20
|
attribute :document_url, String, readonly: true
|
21
|
-
attribute :created_at, DateTime, readonly: true
|
22
|
-
attribute :updated_at, DateTime, readonly: true
|
23
21
|
end
|
24
22
|
|
25
23
|
class InvoiceAdapter < BaseAdapter
|
@@ -5,7 +5,8 @@ module Gecko
|
|
5
5
|
class InvoiceLineItem < Base
|
6
6
|
belongs_to :invoice
|
7
7
|
belongs_to :order_line_item
|
8
|
-
belongs_to :ledger_account
|
8
|
+
# belongs_to :ledger_account
|
9
|
+
attribute :ledger_account_id, Integer
|
9
10
|
|
10
11
|
attribute :quantity, BigDecimal
|
11
12
|
attribute :position, Integer
|
data/lib/gecko/record/order.rb
CHANGED
@@ -8,6 +8,7 @@ module Gecko
|
|
8
8
|
has_many :order_line_items
|
9
9
|
|
10
10
|
belongs_to :company
|
11
|
+
belongs_to :contact
|
11
12
|
belongs_to :shipping_address, class_name: 'Address'
|
12
13
|
belongs_to :billing_address, class_name: 'Address'
|
13
14
|
belongs_to :contact, class_name: 'Contact'
|
@@ -16,6 +17,7 @@ module Gecko
|
|
16
17
|
belongs_to :stock_location, class_name: 'Location'
|
17
18
|
belongs_to :currency
|
18
19
|
# belongs_to :default_price_list, class_name: 'PriceList'
|
20
|
+
attribute :default_price_list_id, String
|
19
21
|
|
20
22
|
attribute :order_number, String
|
21
23
|
attribute :phone_number, String
|
@@ -27,7 +29,7 @@ module Gecko
|
|
27
29
|
attribute :fulfillment_status, String, readonly: true
|
28
30
|
attribute :invoice_status, String, readonly: true
|
29
31
|
attribute :payment_status, String
|
30
|
-
attribute :
|
32
|
+
attribute :tax_treatment, String
|
31
33
|
attribute :issued_at, Date
|
32
34
|
attribute :ship_at, Date
|
33
35
|
attribute :tags, Array[String]
|
@@ -41,7 +43,9 @@ module Gecko
|
|
41
43
|
|
42
44
|
## DEPRECATED
|
43
45
|
attribute :tracking_number, String, readonly: true
|
46
|
+
|
44
47
|
# attribute :source, String
|
48
|
+
|
45
49
|
# attribute :invoice_numbers, Hash[Integer => String], readonly: true
|
46
50
|
end
|
47
51
|
|
@@ -12,7 +12,8 @@ module Gecko
|
|
12
12
|
belongs_to :billing_address, class_name: "Location"
|
13
13
|
|
14
14
|
belongs_to :currency
|
15
|
-
belongs_to :default_price_list, class_name: "PriceList"
|
15
|
+
# belongs_to :default_price_list, class_name: "PriceList"
|
16
|
+
attribute :default_price_list_id, String
|
16
17
|
|
17
18
|
attribute :order_number, String
|
18
19
|
attribute :reference_number, String
|
@@ -20,20 +21,16 @@ module Gecko
|
|
20
21
|
attribute :due_at, Date
|
21
22
|
|
22
23
|
attribute :status, String
|
23
|
-
attribute :procurement_status, String
|
24
|
+
attribute :procurement_status, String, readonly: true
|
24
25
|
attribute :notes, String
|
25
26
|
attribute :tax_treatment, String
|
26
27
|
|
27
|
-
attribute :destination_url, String
|
28
|
-
attribute :document_url, String
|
28
|
+
attribute :destination_url, String, readonly: true
|
29
|
+
attribute :document_url, String, readonly: true
|
29
30
|
|
30
|
-
attribute :total, BigDecimal
|
31
|
-
attribute :cached_quantity, BigDecimal
|
32
|
-
attribute :cached_total, BigDecimal
|
33
|
-
|
34
|
-
# DEPRECATED
|
35
|
-
# attribute :tax_type, String
|
36
|
-
# attribute :default_price_type_id
|
31
|
+
attribute :total, BigDecimal, readonly: true
|
32
|
+
attribute :cached_quantity, BigDecimal, readonly: true
|
33
|
+
attribute :cached_total, BigDecimal, readonly: true
|
37
34
|
end
|
38
35
|
|
39
36
|
class PurchaseOrderAdapter < BaseAdapter
|
@@ -14,10 +14,10 @@ module Gecko
|
|
14
14
|
attribute :price, BigDecimal
|
15
15
|
attribute :label, String
|
16
16
|
attribute :freeform, Boolean
|
17
|
-
attribute :base_price, BigDecimal
|
18
|
-
attribute :extra_cost_value, BigDecimal
|
19
|
-
attribute :image_url, String
|
20
17
|
|
18
|
+
attribute :base_price, BigDecimal, readonly: true
|
19
|
+
attribute :extra_cost_value, BigDecimal, readonly: true
|
20
|
+
attribute :image_url, String, readonly: true
|
21
21
|
# DEPRECATED
|
22
22
|
# attribute :tax_rate, String
|
23
23
|
end
|
@@ -5,8 +5,6 @@ module Gecko
|
|
5
5
|
class TaxType < Base
|
6
6
|
attribute :name, String
|
7
7
|
attribute :code, String
|
8
|
-
attribute :xero_online_id, String, readonly: true
|
9
|
-
attribute :imported_from, String, readonly: true
|
10
8
|
attribute :effective_rate, BigDecimal, readonly: true
|
11
9
|
|
12
10
|
attribute :status, String, readonly: true
|
data/lib/gecko/record/user.rb
CHANGED
@@ -5,23 +5,26 @@ module Gecko
|
|
5
5
|
class User < Base
|
6
6
|
attribute :first_name, String
|
7
7
|
attribute :last_name, String
|
8
|
-
attribute :email, String
|
8
|
+
attribute :email, String, readonly: true
|
9
9
|
attribute :location, String
|
10
10
|
attribute :position, String
|
11
11
|
attribute :phone_number, String
|
12
|
-
attribute :
|
13
|
-
attribute :last_sign_in_at, DateTime
|
14
|
-
attribute :avatar_url, String
|
12
|
+
attribute :mobile, String
|
13
|
+
attribute :last_sign_in_at, DateTime, readonly: true
|
14
|
+
attribute :avatar_url, String, readonly: true
|
15
15
|
|
16
|
-
attribute :status, String
|
16
|
+
attribute :status, String, readonly: true
|
17
|
+
attribute :billing_contact, Boolean, readonly: true
|
17
18
|
|
18
19
|
# attribute :sales_report_email, Boolean
|
19
20
|
# attribute :action_items_email, String
|
20
21
|
|
21
|
-
# attribute :billing_contact, Boolean
|
22
22
|
# attribute :notification_email, Boolean
|
23
|
-
# attribute :
|
23
|
+
# attribute :permissions, Array[String]
|
24
24
|
# attribute :account_id, Integer
|
25
|
+
|
26
|
+
## DEPRECATED
|
27
|
+
attribute :mobile_phone, String
|
25
28
|
end
|
26
29
|
|
27
30
|
class UserAdapter < BaseAdapter
|
data/lib/gecko/version.rb
CHANGED
@@ -20,7 +20,7 @@ class Gecko::FulfillmentTest < Minitest::Test
|
|
20
20
|
json_keys = %w(
|
21
21
|
order_id shipping_address_id billing_address_id status exchange_rate
|
22
22
|
delivery_type tracking_number notes tracking_url tracking_company packed_at
|
23
|
-
shipped_at received_at receipt
|
23
|
+
service shipped_at received_at receipt
|
24
24
|
).map(&:to_sym)
|
25
25
|
assert_equal json_keys.sort, @record.as_json[:fulfillment].keys.sort
|
26
26
|
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.0
|
4
|
+
version: 0.1.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: 2015-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|