bigcommerce 0.10.0 → 1.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.rubocop.yml +620 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +119 -0
- data/DEPENDENCIES.md +7 -0
- data/Gemfile +15 -0
- data/Guardfile +22 -0
- data/LICENSE +15 -15
- data/README.md +61 -70
- data/RELEASING.md +64 -0
- data/Rakefile +8 -6
- data/bigcommerce.gemspec +22 -53
- data/examples/README.md +148 -0
- data/examples/configuration/legacy_auth.rb +12 -0
- data/examples/configuration/oauth.rb +9 -0
- data/examples/content/blog_post.rb +39 -0
- data/examples/content/blog_tag.rb +10 -0
- data/examples/content/redirect.rb +43 -0
- data/examples/customers/customer.rb +36 -0
- data/examples/customers/customer_address.rb +50 -0
- data/examples/customers/customer_group.rb +35 -0
- data/examples/exception_handling.rb +50 -0
- data/examples/geography/country.rb +16 -0
- data/examples/geography/state.rb +19 -0
- data/examples/marketing/coupon.rb +44 -0
- data/examples/orders/order.rb +53 -0
- data/examples/orders/order_coupon.rb +17 -0
- data/examples/orders/order_message.rb +17 -0
- data/examples/orders/order_product.rb +23 -0
- data/examples/orders/order_shipping_address.rb +23 -0
- data/examples/orders/order_status.rb +15 -0
- data/examples/orders/order_tax.rb +17 -0
- data/examples/orders/shipment.rb +57 -0
- data/examples/payments/payment_method.rb +10 -0
- data/examples/products/brand.rb +36 -0
- data/examples/products/bulk_pricing_rule.rb +47 -0
- data/examples/products/category.rb +37 -0
- data/examples/products/configurable_field.rb +29 -0
- data/examples/products/custom_field.rb +44 -0
- data/examples/products/google_product_search_mapping.rb +12 -0
- data/examples/products/option.rb +37 -0
- data/examples/products/option_set.rb +35 -0
- data/examples/products/option_set_option.rb +50 -0
- data/examples/products/option_value.rb +43 -0
- data/examples/products/product.rb +44 -0
- data/examples/products/product_image.rb +42 -0
- data/examples/products/product_option.rb +17 -0
- data/examples/products/product_review.rb +12 -0
- data/examples/products/product_rule.rb +54 -0
- data/examples/products/product_video.rb +45 -0
- data/examples/products/sku.rb +48 -0
- data/examples/shipping/shipping_method.rb +13 -0
- data/examples/store/store_info.rb +10 -0
- data/examples/system/time.rb +10 -0
- data/examples/tax/tax_class.rb +13 -0
- data/examples/webhooks/webhook.rb +29 -0
- data/lib/bigcommerce.rb +50 -8
- data/lib/bigcommerce/exception.rb +51 -0
- data/lib/bigcommerce/middleware/auth.rb +16 -0
- data/lib/bigcommerce/middleware/http_exception.rb +14 -0
- data/lib/bigcommerce/request.rb +89 -0
- data/lib/bigcommerce/resource_actions.rb +51 -0
- data/lib/bigcommerce/resources/content/blog_post.rb +31 -0
- data/lib/bigcommerce/resources/content/blog_tag.rb +17 -0
- data/lib/bigcommerce/resources/content/redirect.rb +21 -0
- data/lib/bigcommerce/resources/customers/customer.rb +30 -0
- data/lib/bigcommerce/resources/customers/customer_address.rb +34 -0
- data/lib/bigcommerce/resources/customers/customer_group.rb +21 -0
- data/lib/bigcommerce/resources/geography/country.rb +22 -0
- data/lib/bigcommerce/resources/geography/state.rb +25 -0
- data/lib/bigcommerce/resources/marketing/coupon.rb +30 -0
- data/lib/bigcommerce/resources/orders/order.rb +73 -0
- data/lib/bigcommerce/resources/orders/order_coupon.rb +20 -0
- data/lib/bigcommerce/resources/orders/order_message.rb +23 -0
- data/lib/bigcommerce/resources/orders/order_product.rb +64 -0
- data/lib/bigcommerce/resources/orders/order_shipping_address.rb +50 -0
- data/lib/bigcommerce/resources/orders/order_status.rb +16 -0
- data/lib/bigcommerce/resources/orders/order_tax.rb +23 -0
- data/lib/bigcommerce/resources/orders/shipment.rb +30 -0
- data/lib/bigcommerce/resources/payments/payment_method.rb +17 -0
- data/lib/bigcommerce/resources/products/brand.rb +23 -0
- data/lib/bigcommerce/resources/products/bulk_pricing_rule.rb +26 -0
- data/lib/bigcommerce/resources/products/category.rb +29 -0
- data/lib/bigcommerce/resources/products/configurable_field.rb +30 -0
- data/lib/bigcommerce/resources/products/custom_field.rb +24 -0
- data/lib/bigcommerce/resources/products/google_product_search_mapping.rb +26 -0
- data/lib/bigcommerce/resources/products/option.rb +20 -0
- data/lib/bigcommerce/resources/products/option_set.rb +18 -0
- data/lib/bigcommerce/resources/products/option_set_option.rb +19 -0
- data/lib/bigcommerce/resources/products/option_value.rb +15 -0
- data/lib/bigcommerce/resources/products/product.rb +97 -0
- data/lib/bigcommerce/resources/products/product_image.rb +31 -0
- data/lib/bigcommerce/resources/products/product_option.rb +17 -0
- data/lib/bigcommerce/resources/products/product_review.rb +22 -0
- data/lib/bigcommerce/resources/products/product_rule.rb +31 -0
- data/lib/bigcommerce/resources/products/product_video.rb +24 -0
- data/lib/bigcommerce/resources/products/sku.rb +29 -0
- data/lib/bigcommerce/resources/resource.rb +10 -0
- data/lib/bigcommerce/resources/shipping/shipping_method.rb +15 -0
- data/lib/bigcommerce/resources/store/store_information.rb +37 -0
- data/lib/bigcommerce/resources/system/time.rb +15 -0
- data/lib/bigcommerce/resources/tax/tax_class.rb +15 -0
- data/lib/bigcommerce/resources/webhooks/webhook.rb +22 -0
- data/lib/bigcommerce/subresource_actions.rb +43 -0
- data/lib/bigcommerce/version.rb +1 -4
- data/spec/bigcommerce/bigcommerce_spec.rb +76 -0
- data/spec/bigcommerce/unit/actions_spec.rb +151 -0
- data/spec/bigcommerce/unit/exception_spec.rb +53 -0
- data/spec/bigcommerce/unit/middleware/auth_spec.rb +18 -0
- data/spec/bigcommerce/unit/middleware/http_exception_spec.rb +40 -0
- data/spec/bigcommerce/unit/request_spec.rb +180 -0
- data/spec/bigcommerce/unit/resources/content/blog_post_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/content/blog_tag_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/content/redirect_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/customers/customer_address_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/customers/customer_group_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/customers/customer_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/geography/country_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/geography/state_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/marketing/coupon_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/orders/order_product_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/orders/order_shipping_address_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/orders/order_spec.rb +13 -0
- data/spec/bigcommerce/unit/resources/orders/shipment_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/payments/payment_method_spec.rb +23 -0
- data/spec/bigcommerce/unit/resources/products/brand_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/bulk_pricing_rule_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/category_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/configurable_field_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/custom_field_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/google_product_search_mapping_spec.rb +14 -0
- data/spec/bigcommerce/unit/resources/products/option_set_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/option_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/products/product_image_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/product_review_spec.rb +14 -0
- data/spec/bigcommerce/unit/resources/products/product_rule_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/product_spec.rb +13 -0
- data/spec/bigcommerce/unit/resources/products/product_video_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/products/sku_spec.rb +21 -0
- data/spec/bigcommerce/unit/resources/resource_spec.rb +4 -0
- data/spec/bigcommerce/unit/resources/store_info/store_information_spec.rb +12 -0
- data/spec/bigcommerce/unit/resources/system/time_spec.rb +12 -0
- data/spec/bigcommerce/unit/version_spec.rb +7 -0
- data/spec/spec_helper.rb +9 -25
- metadata +203 -127
- data/lib/big_commerce.rb +0 -1
- data/lib/bigcommerce/api.rb +0 -473
- data/lib/bigcommerce/connection.rb +0 -171
- data/lib/bigcommerce/product.rb +0 -13
- data/lib/bigcommerce/resource.rb +0 -50
- data/spec/big_commerce_spec.rb +0 -9
- data/spec/integration/orders_spec.rb +0 -18
- data/spec/support/integration_context.rb +0 -13
- data/spec/support/mock_api_context.rb +0 -10
- data/spec/unit/api_request_spec.rb +0 -34
- data/spec/unit/api_spec.rb +0 -49
- data/spec/unit/connection_spec.rb +0 -23
- data/spec/unit/date_time_spec.rb +0 -31
- data/spec/unit/version_spec.rb +0 -13
@@ -0,0 +1,51 @@
|
|
1
|
+
module Bigcommerce
|
2
|
+
class ResourceActions < Module
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
tap do |mod|
|
8
|
+
mod.define_singleton_method :_options do
|
9
|
+
mod.options
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def included(base)
|
15
|
+
base.send(:include, Request.new(options[:uri]))
|
16
|
+
base.extend(ClassMethods)
|
17
|
+
options[:disable_methods] ||= []
|
18
|
+
methods = ClassMethods.public_instance_methods & options[:disable_methods]
|
19
|
+
methods.each { |name| base.send(:remove_method, name) }
|
20
|
+
end
|
21
|
+
|
22
|
+
module ClassMethods
|
23
|
+
def all(params = {})
|
24
|
+
get path.build, params
|
25
|
+
end
|
26
|
+
|
27
|
+
def find(resource_id)
|
28
|
+
fail ArgumentError if resource_id.nil?
|
29
|
+
get path.build(resource_id)
|
30
|
+
end
|
31
|
+
|
32
|
+
def create(params)
|
33
|
+
post path.build, params
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(resource_id, params)
|
37
|
+
fail ArgumentError if resource_id.nil?
|
38
|
+
put path.build(resource_id), params
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy(resource_id)
|
42
|
+
fail ArgumentError if resource_id.nil?
|
43
|
+
delete path.build(resource_id)
|
44
|
+
end
|
45
|
+
|
46
|
+
def destroy_all
|
47
|
+
delete path.build
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Blog Post
|
2
|
+
# Content entries in the store's blog.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/blog/posts
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class BlogPost < Resource
|
7
|
+
include Bigcommerce::ResourceActions.new uri: 'blog/posts/%d'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :url
|
11
|
+
property :count
|
12
|
+
property :preview_url
|
13
|
+
property :body
|
14
|
+
property :tags
|
15
|
+
property :summary
|
16
|
+
property :title
|
17
|
+
property :content
|
18
|
+
property :author
|
19
|
+
property :author_url
|
20
|
+
property :is_published
|
21
|
+
property :published_date
|
22
|
+
property :published_at
|
23
|
+
property :meta_description
|
24
|
+
property :meta_keywords
|
25
|
+
property :thumbnail_path
|
26
|
+
|
27
|
+
def self.count
|
28
|
+
get 'blog/posts/count'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Blog Tag
|
2
|
+
# Index of tags used on the store's blog.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/blog/tags
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class BlogTag < Resource
|
7
|
+
include Bigcommerce::Request.new 'blog/tags'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :tag
|
11
|
+
property :post_ids
|
12
|
+
|
13
|
+
def self.all
|
14
|
+
get path.build
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Redirect
|
2
|
+
# Redirects are used to create custom URL paths that map to resources on the
|
3
|
+
# storefront (such as products, categories, brands, etc.) or manually defined
|
4
|
+
# static URLs.
|
5
|
+
# https://developer.bigcommerce.com/api/stores/v2/redirects
|
6
|
+
|
7
|
+
module Bigcommerce
|
8
|
+
class Redirect < Resource
|
9
|
+
include Bigcommerce::ResourceActions.new uri: 'redirects/%d'
|
10
|
+
|
11
|
+
property :id
|
12
|
+
property :count
|
13
|
+
property :path
|
14
|
+
property :forward
|
15
|
+
property :url
|
16
|
+
|
17
|
+
def self.count
|
18
|
+
get 'redirects/count'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Customer
|
2
|
+
# Identity and account details for customers shopping at a Bigcommerce store.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/customers
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class Customer < Resource
|
7
|
+
include Bigcommerce::ResourceActions.new uri: 'customers/%d'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :_authentication
|
11
|
+
property :count
|
12
|
+
property :company
|
13
|
+
property :first_name
|
14
|
+
property :last_name
|
15
|
+
property :email
|
16
|
+
property :phone
|
17
|
+
property :date_created
|
18
|
+
property :date_modified
|
19
|
+
property :store_credit
|
20
|
+
property :registration_ip_address
|
21
|
+
property :customer_group_id
|
22
|
+
property :notes
|
23
|
+
property :addresses
|
24
|
+
property :tax_exempt_category
|
25
|
+
|
26
|
+
def self.count
|
27
|
+
get 'customers/count'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Customer Address
|
2
|
+
# Postal addresses belonging to a customer.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/customers/addresses
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class CustomerAddress < Resource
|
7
|
+
include Bigcommerce::SubresourceActions.new uri: 'customers/%d/addresses/%d'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :customer_id
|
11
|
+
property :first_name
|
12
|
+
property :address_type
|
13
|
+
property :count
|
14
|
+
property :last_name
|
15
|
+
property :company
|
16
|
+
property :street_1
|
17
|
+
property :street_2
|
18
|
+
property :city
|
19
|
+
property :state
|
20
|
+
property :zip
|
21
|
+
property :country
|
22
|
+
property :country_iso2
|
23
|
+
property :phone
|
24
|
+
property :adderss_type
|
25
|
+
|
26
|
+
def self.count_all
|
27
|
+
get 'customers/addresses/count'
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.count(customer_id)
|
31
|
+
get "customers/#{customer_id}/addresses/count"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Customer Group
|
2
|
+
# Groups of customers who share the same level of access and discounts
|
3
|
+
# at a store.
|
4
|
+
# https://developer.bigcommerce.com/api/stores/v2/customer_groups
|
5
|
+
|
6
|
+
module Bigcommerce
|
7
|
+
class CustomerGroup < Resource
|
8
|
+
include Bigcommerce::ResourceActions.new uri: 'customer_groups/%d'
|
9
|
+
|
10
|
+
property :id
|
11
|
+
property :name
|
12
|
+
property :count
|
13
|
+
property :is_default
|
14
|
+
property :category_access
|
15
|
+
property :discount_rules
|
16
|
+
|
17
|
+
def self.count
|
18
|
+
get 'customer_groups/count'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Country
|
2
|
+
# Countries and territories, identified by their ISO 3166 country codes.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/countries
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class Country < Resource
|
7
|
+
include Bigcommerce::ResourceActions.new(
|
8
|
+
uri: 'countries/%d',
|
9
|
+
disable: [:create, :update, :destroy, :destroy_all])
|
10
|
+
|
11
|
+
property :id
|
12
|
+
property :count
|
13
|
+
property :country
|
14
|
+
property :country_iso2
|
15
|
+
property :country_iso3
|
16
|
+
property :states
|
17
|
+
|
18
|
+
def self.count
|
19
|
+
get 'countries/count'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# State
|
2
|
+
# States and subdivisions belonging to countries.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/countries/states
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class State < Resource
|
7
|
+
include Bigcommerce::SubresourceActions.new(
|
8
|
+
uri: 'countries/%d/states/%d',
|
9
|
+
disable: [:create, :update, :destroy, :destroy_all])
|
10
|
+
|
11
|
+
property :id
|
12
|
+
property :count
|
13
|
+
property :state
|
14
|
+
property :state_abbreviation
|
15
|
+
property :country_id
|
16
|
+
|
17
|
+
def self.count(country_id)
|
18
|
+
get "countries/#{country_id}/states/count"
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.count_all
|
22
|
+
get 'countries/states/count'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Coupon
|
2
|
+
# Category or product discounts that can be applied to orders for customers
|
3
|
+
# who enter a given code.
|
4
|
+
# https://developer.bigcommerce.com/api/stores/v2/coupons
|
5
|
+
|
6
|
+
module Bigcommerce
|
7
|
+
class Coupon < Resource
|
8
|
+
include Bigcommerce::ResourceActions.new uri: 'coupons/%d'
|
9
|
+
|
10
|
+
property :id
|
11
|
+
property :name
|
12
|
+
property :type
|
13
|
+
property :count
|
14
|
+
property :amount
|
15
|
+
property :min_purchase
|
16
|
+
property :expires
|
17
|
+
property :enabled
|
18
|
+
property :code
|
19
|
+
property :applies_to
|
20
|
+
property :num_uses
|
21
|
+
property :max_uses
|
22
|
+
property :max_uses_per_customer
|
23
|
+
property :restricted_to
|
24
|
+
property :shipping_methods
|
25
|
+
|
26
|
+
def self.count
|
27
|
+
get 'coupons/count'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Order
|
2
|
+
# Purchases from a store.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/orders
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class Order < Resource
|
7
|
+
include Bigcommerce::ResourceActions.new uri: 'orders/%d'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :count
|
11
|
+
property :customer_id
|
12
|
+
property :date_created
|
13
|
+
property :date_modified
|
14
|
+
property :date_shipped
|
15
|
+
property :status_id
|
16
|
+
property :status
|
17
|
+
property :subtotal_ex_tax
|
18
|
+
property :subtotal_inc_tax
|
19
|
+
property :subtotal_tax
|
20
|
+
property :base_shipping_cost
|
21
|
+
property :shipping_cost_ex_tax
|
22
|
+
property :shipping_cost_inc_tax
|
23
|
+
property :shipping_cost_tax
|
24
|
+
property :shipping_cost_tax_class_id
|
25
|
+
property :base_handling_cost
|
26
|
+
property :handling_cost_ex_tax
|
27
|
+
property :handling_cost_inc_tax
|
28
|
+
property :handling_cost_tax
|
29
|
+
property :handling_cost_tax_class_id
|
30
|
+
property :base_wrapping_cost
|
31
|
+
property :wrapping_cost_ex_tax
|
32
|
+
property :wrapping_cost_inc_tax
|
33
|
+
property :wrapping_cost_tax
|
34
|
+
property :wrapping_cost_tax_class_id
|
35
|
+
property :total_ex_tax
|
36
|
+
property :total_inc_tax
|
37
|
+
property :total_tax
|
38
|
+
property :items_total
|
39
|
+
property :items_shipped
|
40
|
+
property :payment_method
|
41
|
+
property :payment_provider_id
|
42
|
+
property :payment_status
|
43
|
+
property :refunded_amount
|
44
|
+
property :order_is_digital
|
45
|
+
property :store_credit_amount
|
46
|
+
property :gift_certificate_amount
|
47
|
+
property :ip_address
|
48
|
+
property :geoip_country
|
49
|
+
property :geoip_country_iso2
|
50
|
+
property :currency_id
|
51
|
+
property :currency_code
|
52
|
+
property :currency_exchange_rate
|
53
|
+
property :default_currency_id
|
54
|
+
property :default_currency_code
|
55
|
+
property :staff_notes
|
56
|
+
property :customer_message
|
57
|
+
property :discount_amount
|
58
|
+
property :coupon_discount
|
59
|
+
property :shipping_address_count
|
60
|
+
property :is_deleted
|
61
|
+
property :ebay_order_id
|
62
|
+
property :billing_address
|
63
|
+
property :order_source
|
64
|
+
property :external_source
|
65
|
+
property :products
|
66
|
+
property :shipping_addresses
|
67
|
+
property :coupons
|
68
|
+
|
69
|
+
def self.count(params = {})
|
70
|
+
get 'orders/count', params
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Order Coupon
|
2
|
+
# Coupons applied to an order.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/orders/coupons
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class OrderCoupon < Resource
|
7
|
+
include Bigcommerce::SubresourceActions.new(
|
8
|
+
uri: 'orders/%d/coupons/%d',
|
9
|
+
disable: [:create, :update, :destroy, :destroy_all])
|
10
|
+
|
11
|
+
property :id
|
12
|
+
property :coupon_id
|
13
|
+
property :order_id
|
14
|
+
property :code
|
15
|
+
property :amount
|
16
|
+
property :type
|
17
|
+
property :type
|
18
|
+
property :discount
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Order Message
|
2
|
+
# Messages associated with an order.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/orders/messages
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class OrderMessage < Resource
|
7
|
+
include Bigcommerce::SubresourceActions.new(
|
8
|
+
uri: 'orders/%d/messages/%d',
|
9
|
+
disable: [:create, :update, :destroy, :destroy_all])
|
10
|
+
|
11
|
+
property :id
|
12
|
+
property :order_id
|
13
|
+
property :staff_id
|
14
|
+
property :customer_id
|
15
|
+
property :type
|
16
|
+
property :subject
|
17
|
+
property :message
|
18
|
+
property :status
|
19
|
+
property :is_flagged
|
20
|
+
property :date_created
|
21
|
+
property :customer
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Order Product
|
2
|
+
# Product line items associated with an order.
|
3
|
+
# https://developer.bigcommerce.com/api/stores/v2/orders/products
|
4
|
+
|
5
|
+
module Bigcommerce
|
6
|
+
class OrderProduct < Resource
|
7
|
+
include Bigcommerce::SubresourceActions.new(
|
8
|
+
uri: 'orders/%d/products/%d',
|
9
|
+
disable: [:create, :update, :destroy, :destroy_all])
|
10
|
+
|
11
|
+
property :id
|
12
|
+
property :order_id
|
13
|
+
property :product_id
|
14
|
+
property :order_address_id
|
15
|
+
property :name
|
16
|
+
property :sku
|
17
|
+
property :type
|
18
|
+
property :count
|
19
|
+
property :base_price
|
20
|
+
property :price_ex_tax
|
21
|
+
property :price_inc_tax
|
22
|
+
property :price_tax
|
23
|
+
property :base_total
|
24
|
+
property :total_ex_tax
|
25
|
+
property :total_inc_tax
|
26
|
+
property :total_tax
|
27
|
+
property :weight
|
28
|
+
property :quantity
|
29
|
+
property :base_cost_price
|
30
|
+
property :cost_price_inc_tax
|
31
|
+
property :cost_price_ex_tax
|
32
|
+
property :cost_price_tax
|
33
|
+
property :is_refunded
|
34
|
+
property :refund_amount
|
35
|
+
property :return_id
|
36
|
+
property :wrapping_name
|
37
|
+
property :base_wrapping_cost
|
38
|
+
property :wrapping_cost_ex_tax
|
39
|
+
property :wrapping_cost_inc_tax
|
40
|
+
property :wrapping_cost_tax
|
41
|
+
property :wrapping_message
|
42
|
+
property :quantity_shipped
|
43
|
+
property :event_name
|
44
|
+
property :event_date
|
45
|
+
property :fixed_shipping_cost
|
46
|
+
property :ebay_item_id
|
47
|
+
property :ebay_transaction_id
|
48
|
+
property :option_set_id
|
49
|
+
property :parent_order_product_id
|
50
|
+
property :is_bundled_product, from: :'is_bundled_product '
|
51
|
+
property :bin_picking_number
|
52
|
+
property :applied_discounts
|
53
|
+
property :product_options
|
54
|
+
property :configurable_fields
|
55
|
+
|
56
|
+
def self.count(order_id)
|
57
|
+
get "orders/#{order_id}/products/count"
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.count_all
|
61
|
+
get 'orders/products/count'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|