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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2bd2a2393ff6dd9e993c46f1e8db2154403a5f2
4
- data.tar.gz: 92d6089553b46d1357821c96aed81e7870c878d7
3
+ metadata.gz: 08f0ea519c51017bd91d6d4a2345c1610213a2f8
4
+ data.tar.gz: d3ec91d7ece3d1099d76b3f1de88f98be1e16505
5
5
  SHA512:
6
- metadata.gz: 0d2dd5309f536cd463a540464f3e886801155ba5c35c001cd454ad589f3cfb3418bb4b9e996260ce15358cd6ec40a72409db3b9e75a32cb3fa00f4cb76b06766
7
- data.tar.gz: 134aebb58b9487d85a260c5f5be00d9a38c464018f4adcaed83bb5efaa79d861b911252cef2558ea37174d0047226a487fc11a16288f067d59e00db9313dd6ab
6
+ metadata.gz: 7ff2a4ed0decd8212e1c91a50fb9bfc4c9b256f21a77fce2008137172884d40e0fcf64dc1b5039f32e6d9005f335c4fed534ebca84d3aaa62cc7fc62fbd4fd1e
7
+ data.tar.gz: c07e8454750c183de6a4af0a9b88ea74b69cc1986ea2974d65f6f7d2867c8dfa1c4621fce172e58b25baeea36b9ce06196171402f65f4a1dc92dc850d5300dca
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.0 (2015-11-25)
2
+ - Move default headers to the adapter base class to make it easier to merge them when overriding
3
+ - Clean up old attributes
4
+
1
5
  ## 0.0.10 (2015-10-21)
2
6
  - Add first_name/last_name to addresses
3
7
 
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}",
@@ -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
- # attribute :subscription_name, String
43
- # attribute :subscription_price, String
44
- # attribute :annual_subscription_price, String
45
- # attribute :expires_at, String
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
@@ -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, class_name: "User"
7
- belongs_to :default_tax_type, class_name: "TaxType"
8
- belongs_to :default_payment_term, class_name: "PaymentTerm"
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, readonly: true
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
@@ -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
@@ -21,6 +21,7 @@ module Gecko
21
21
  attribute :packed_at, Date
22
22
  attribute :shipped_at, DateTime
23
23
  attribute :received_at, DateTime
24
+ attribute :service, String
24
25
 
25
26
  attribute :receipt, Hash
26
27
  end
@@ -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
@@ -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
@@ -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 :tax_type, String
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
@@ -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 :mobile_phone, String
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 :permisssions, Array[String]
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
@@ -1,3 +1,3 @@
1
1
  module Gecko
2
- VERSION = '0.0.10'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -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.10
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-10-21 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler