bigcommerce_api 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,18 @@
1
1
  module BigcommerceAPI
2
-
3
2
  class Rule < Resource
4
- attr_accessor :id, :product_id, :sort_order, :is_enabled, :is_stop, :price_adjuster, :weight_adjuster,
5
- :is_purchasing_disabled, :purchasing_disabled_message, :is_purchasing_hidden, :image_file,
6
- :conditions
3
+ attr_accessor :id,
4
+ :conditions,
5
+ :image_file,
6
+ :is_enabled,
7
+ :is_purchasing_disabled,
8
+ :is_purchasing_hidden,
9
+ :is_stop,
10
+ :price_adjuster,
11
+ :product_id,
12
+ :purchasing_disabled_message,
13
+ :sort_order,
14
+ :weight_adjuster
7
15
 
8
16
  belongs_to :product
9
-
10
17
  end
11
-
12
- end
18
+ end
@@ -1,9 +1,20 @@
1
1
  module BigcommerceAPI
2
-
3
2
  class Shipment < Resource
4
- attr_accessor :items, :comments, :order_id, :shipping_address, :order_address_id, :id, :tracking_number, :billing_address, :customer_id, :shipping_method, :date_created
5
-
6
- belongs_to :customer, {:order_address => :shipping_address}, :order
3
+ attr_accessor :id,
4
+ :billing_address,
5
+ :comments,
6
+ :customer_id,
7
+ :date_created,
8
+ :items,
9
+ :order_address_id,
10
+ :order_id,
11
+ :shipping_address,
12
+ :shipping_method,
13
+ :tracking_number
14
+
15
+ belongs_to :customer,
16
+ { order_address: :shipping_address },
17
+ :order
7
18
 
8
19
  # these are all overrides, since Shipments work a little differently
9
20
  def resource_url
@@ -20,7 +31,7 @@ module BigcommerceAPI
20
31
 
21
32
  class << self
22
33
  def all(order_id, params={})
23
- resources = BigcommerceAPI::Base.get("/orders/#{order_id}/shipments", :query => date_adjust(params))
34
+ resources = BigcommerceAPI::Base.get("/orders/#{order_id}/shipments", query: date_adjust(params))
24
35
  (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : []
25
36
  end
26
37
 
@@ -29,7 +40,5 @@ module BigcommerceAPI
29
40
  (r.success? and !r.nil?) ? self.new(r) : nil
30
41
  end
31
42
  end
32
-
33
43
  end
34
-
35
- end
44
+ end
@@ -0,0 +1,75 @@
1
+ module BigcommerceAPI
2
+ class ShippingAddress < Resource
3
+ attr_accessor :id,
4
+ :base_cost,
5
+ :base_handling_cost,
6
+ :city,
7
+ :company,
8
+ :cost_ex_tax,
9
+ :cost_inc_tax,
10
+ :cost_tax,
11
+ :cost_tax_class_id,
12
+ :country,
13
+ :country_iso2,
14
+ :email,
15
+ :first_name,
16
+ :handling_cost_ex_tax,
17
+ :handling_cost_inc_tax,
18
+ :handling_cost_tax,
19
+ :handling_cost_tax_class_id,
20
+ :items_shipped,
21
+ :items_total,
22
+ :last_name,
23
+ :order_id,
24
+ :phone,
25
+ :shipping_method,
26
+ :shipping_zone_id,
27
+ :shipping_zone_name,
28
+ :state,
29
+ :street_1,
30
+ :street_2,
31
+ :zip
32
+
33
+ belongs_to :shipping_zone,
34
+ :order
35
+
36
+ # this overrides the default method, since this has to come in with an order id
37
+ def resource_url
38
+ "orders/#{self.order_id}/shipping_addresses"
39
+ end
40
+
41
+ def parent
42
+ 'order'
43
+ end
44
+
45
+ # TODO: these can probably go in a ReadOnly class
46
+ def save
47
+ self.errors = ["Shipping Addresses are readonly"]
48
+ return false
49
+ end
50
+
51
+ def create(params={})
52
+ self.errors = ["Shipping Addresses are readonly"]
53
+ return false
54
+ end
55
+
56
+ def find_for_reload
57
+ self.class.find(self.order_id,
58
+ self.id)
59
+ end
60
+
61
+ class << self
62
+ def all(order_id,
63
+ params={})
64
+ resources = BigcommerceAPI::Base.get("/orders/#{order_id}/shipping_addresses", query: date_adjust(params))
65
+ (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : []
66
+ end
67
+
68
+ def find(order_id,
69
+ id)
70
+ r = BigcommerceAPI::Base.get("/orders/#{order_id}/shipping_addresses/#{id}")
71
+ (r.success? and !r.nil?) ? self.new(r) : nil
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,7 +1,14 @@
1
1
  module BigcommerceAPI
2
-
3
2
  class Sku < Resource
4
- attr_accessor :id, :sku, :product_id, :cost_price, :upc, :inventory_level, :inventory_warning_level, :bin_picking_number, :options
3
+ attr_accessor :id,
4
+ :bin_picking_number,
5
+ :cost_price,
6
+ :inventory_level,
7
+ :inventory_warning_level,
8
+ :options,
9
+ :product_id,
10
+ :sku,
11
+ :upc
5
12
 
6
13
  belongs_to :product
7
14
 
@@ -12,20 +19,20 @@ module BigcommerceAPI
12
19
  def parent
13
20
  'product'
14
21
  end
15
-
22
+
16
23
  def product_option_id
17
24
  self.options.first['product_option_id']
18
25
  end
19
-
26
+
20
27
  def option_value_id
21
28
  self.options.first['option_value_id']
22
29
  end
23
-
30
+
24
31
  def product_option
25
32
  po = BigcommerceAPI::Base.get '/products/' + self.product_id.to_s + '/options/' + self.product_option_id.to_s
26
33
  (po.success? and !po.nil?) ? ProductOption.new(po) : nil
27
34
  end
28
-
35
+
29
36
  def option_value
30
37
  po = self.product_option
31
38
  if po # we've got to have a product option for this to work
@@ -36,7 +43,7 @@ module BigcommerceAPI
36
43
  return nil
37
44
  end
38
45
  end
39
-
46
+
40
47
  def description
41
48
  out = Array.new
42
49
  po = self.product_option
@@ -53,7 +60,7 @@ module BigcommerceAPI
53
60
 
54
61
  class << self
55
62
  def all(product_id, params={})
56
- resources = BigcommerceAPI::Base.get("/products/#{product_id}/skus", :query => date_adjust(params))
63
+ resources = BigcommerceAPI::Base.get("/products/#{product_id}/skus", query: date_adjust(params))
57
64
  (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : []
58
65
  end
59
66
 
@@ -62,7 +69,5 @@ module BigcommerceAPI
62
69
  (r.success? and !r.nil?) ? self.new(r) : nil
63
70
  end
64
71
  end
65
-
66
72
  end
67
-
68
- end
73
+ end
@@ -1,7 +1,24 @@
1
- module BigcommerceAPI
2
-
1
+ module BigcommerceAPI
3
2
  class Store < Base
4
- attr_accessor :errors, :id, :domain, :name, :address, :phone, :admin_email, :order_email, :language, :currency, :currency_symbol, :currency_symbol_location, :decimal_separator, :thousands_separator, :decimal_places, :weight_units, :dimension_units, :plan_name, :logo
3
+ attr_accessor :id,
4
+ :address,
5
+ :admin_email,
6
+ :currency,
7
+ :currency_symbol,
8
+ :currency_symbol_location,
9
+ :decimal_places,
10
+ :decimal_separator,
11
+ :dimension_units,
12
+ :domain,
13
+ :errors,
14
+ :language,
15
+ :logo,
16
+ :name,
17
+ :order_email,
18
+ :phone,
19
+ :plan_name,
20
+ :thousands_separator,
21
+ :weight_units
5
22
 
6
23
  # Sample response
7
24
  # {"id"=>"XXXX", "domain"=>"XXXX.mybigcommerce.com", "name"=>"XXXX", "address"=>"", "phone"=>"", "admin_email"=>"XXX", "order_email"=>"XXX", "language"=>"en", "currency"=>"USD", "currency_symbol"=>"$", "decimal_separator"=>".", "thousands_separator"=>",", "decimal_places"=>2, "currency_symbol_location"=>"left", "weight_units"=>"LBS", "dimension_units"=>"Inches", "plan_name"=>"Partner Sandbox"}
@@ -15,7 +32,5 @@ module BigcommerceAPI
15
32
  send(:"#{k}=", val) if self.respond_to? "#{k}="
16
33
  end
17
34
  end
18
-
19
35
  end
20
-
21
- end
36
+ end
@@ -1,10 +1,8 @@
1
1
  module BigcommerceAPI
2
-
3
2
  class TaxClass < Resource
4
- attr_accessor :id, :name
3
+ attr_accessor :id,
4
+ :name
5
5
 
6
6
  has_many :products
7
-
8
7
  end
9
-
10
- end
8
+ end
metadata CHANGED
@@ -1,83 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigcommerce_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Dickson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 2.3.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.3.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  description: Enables Ruby applications to communicate with the BigCommerce API V2.
@@ -88,10 +116,17 @@ extra_rdoc_files:
88
116
  - LICENSE.txt
89
117
  - README.md
90
118
  files:
119
+ - LICENSE.txt
120
+ - README.md
91
121
  - lib/bigcommerce_api.rb
122
+ - lib/bigcommerce_api/address.rb
92
123
  - lib/bigcommerce_api/base.rb
93
124
  - lib/bigcommerce_api/brand.rb
94
125
  - lib/bigcommerce_api/category.rb
126
+ - lib/bigcommerce_api/coupon.rb
127
+ - lib/bigcommerce_api/customer.rb
128
+ - lib/bigcommerce_api/error.rb
129
+ - lib/bigcommerce_api/hook.rb
95
130
  - lib/bigcommerce_api/image.rb
96
131
  - lib/bigcommerce_api/inflections.rb
97
132
  - lib/bigcommerce_api/modules/countable.rb
@@ -100,6 +135,7 @@ files:
100
135
  - lib/bigcommerce_api/option_set_option.rb
101
136
  - lib/bigcommerce_api/option_value.rb
102
137
  - lib/bigcommerce_api/order.rb
138
+ - lib/bigcommerce_api/order_coupon.rb
103
139
  - lib/bigcommerce_api/order_product.rb
104
140
  - lib/bigcommerce_api/order_status.rb
105
141
  - lib/bigcommerce_api/product.rb
@@ -108,12 +144,10 @@ files:
108
144
  - lib/bigcommerce_api/result.rb
109
145
  - lib/bigcommerce_api/rule.rb
110
146
  - lib/bigcommerce_api/shipment.rb
111
- - lib/bigcommerce_api/shippingaddress.rb
147
+ - lib/bigcommerce_api/shipping_address.rb
112
148
  - lib/bigcommerce_api/sku.rb
113
149
  - lib/bigcommerce_api/store.rb
114
150
  - lib/bigcommerce_api/tax_class.rb
115
- - LICENSE.txt
116
- - README.md
117
151
  homepage: http://github.com/ideaoforder/bigcommerce_api
118
152
  licenses:
119
153
  - MIT
@@ -124,17 +158,17 @@ require_paths:
124
158
  - lib
125
159
  required_ruby_version: !ruby/object:Gem::Requirement
126
160
  requirements:
127
- - - ! '>='
161
+ - - ">="
128
162
  - !ruby/object:Gem::Version
129
163
  version: '0'
130
164
  required_rubygems_version: !ruby/object:Gem::Requirement
131
165
  requirements:
132
- - - ! '>='
166
+ - - ">="
133
167
  - !ruby/object:Gem::Version
134
168
  version: '0'
135
169
  requirements: []
136
170
  rubyforge_project:
137
- rubygems_version: 2.1.11
171
+ rubygems_version: 2.4.5.1
138
172
  signing_key:
139
173
  specification_version: 4
140
174
  summary: Enables Ruby applications to communicate with the BigCommerce API
@@ -1,47 +0,0 @@
1
- module BigcommerceAPI
2
-
3
- class Shippingaddress < Resource
4
- attr_accessor :shipping_zone_id, :handling_cost_inc_tax, :city, :company, :handling_cost_tax, :cost_tax_class_id, :zip, :street_1, :items_shipped, :country_iso2, :country, :street_2, :handling_cost_ex_tax, :cost_tax, :order_id, :shipping_zone_name, :handling_cost_tax_class_id, :base_handling_cost, :id, :phone, :last_name, :cost_inc_tax, :base_cost, :shipping_method, :items_total, :cost_ex_tax, :email, :state, :first_name
5
-
6
- belongs_to :shipping_zone, :order
7
-
8
- # this overrides the default method, since this has to come in with an order id
9
- def resource_url
10
- "orders/#{self.order_id}/shippingaddresses"
11
- end
12
-
13
- def parent
14
- 'order'
15
- end
16
-
17
- # TODO: these can probably go in a ReadOnly class
18
- def save
19
- self.errors = ["Shipping Addresses are readonly"]
20
- return false
21
- end
22
-
23
- def create(params={})
24
- self.errors = ["Shipping Addresses are readonly"]
25
- return false
26
- end
27
-
28
- def find_for_reload
29
- self.class.find(self.order_id, self.id)
30
- end
31
-
32
- class << self
33
- def all(order_id, params={})
34
- resources = BigcommerceAPI::Base.get("/orders/#{order_id}/shippingaddresses", :query => date_adjust(params))
35
- (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : []
36
- end
37
-
38
- def find(order_id, id)
39
- r = BigcommerceAPI::Base.get("/orders/#{order_id}/shippingaddresses/#{id}")
40
- (r.success? and !r.nil?) ? self.new(r) : nil
41
- end
42
-
43
- end
44
-
45
- end
46
-
47
- end