bigcommerce 1.0.0.beta → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +115 -39
  3. data/bigcommerce.gemspec +12 -13
  4. data/lib/bigcommerce.rb +5 -34
  5. data/lib/bigcommerce/config.rb +14 -0
  6. data/lib/bigcommerce/connection.rb +26 -0
  7. data/lib/bigcommerce/exception.rb +25 -18
  8. data/lib/bigcommerce/request.rb +8 -9
  9. data/lib/bigcommerce/resource_actions.rb +11 -11
  10. data/lib/bigcommerce/resources/content/blog_post.rb +3 -5
  11. data/lib/bigcommerce/resources/content/blog_tag.rb +2 -3
  12. data/lib/bigcommerce/resources/content/redirect.rb +2 -2
  13. data/lib/bigcommerce/resources/customers/customer.rb +22 -2
  14. data/lib/bigcommerce/resources/customers/customer_address.rb +5 -5
  15. data/lib/bigcommerce/resources/customers/customer_group.rb +2 -2
  16. data/lib/bigcommerce/resources/geography/country.rb +4 -3
  17. data/lib/bigcommerce/resources/geography/state.rb +6 -5
  18. data/lib/bigcommerce/resources/marketing/banner.rb +21 -0
  19. data/lib/bigcommerce/resources/marketing/coupon.rb +2 -2
  20. data/lib/bigcommerce/resources/marketing/gift_certificates.rb +25 -0
  21. data/lib/bigcommerce/resources/orders/order.rb +46 -44
  22. data/lib/bigcommerce/resources/orders/order_coupon.rb +5 -5
  23. data/lib/bigcommerce/resources/orders/order_message.rb +8 -7
  24. data/lib/bigcommerce/resources/orders/order_product.rb +37 -36
  25. data/lib/bigcommerce/resources/orders/order_shipping_address.rb +24 -23
  26. data/lib/bigcommerce/resources/orders/order_status.rb +2 -1
  27. data/lib/bigcommerce/resources/orders/order_tax.rb +8 -7
  28. data/lib/bigcommerce/resources/orders/shipment.rb +11 -10
  29. data/lib/bigcommerce/resources/products/brand.rb +2 -2
  30. data/lib/bigcommerce/resources/products/bulk_pricing_rule.rb +6 -5
  31. data/lib/bigcommerce/resources/products/category.rb +2 -2
  32. data/lib/bigcommerce/resources/products/configurable_field.rb +6 -5
  33. data/lib/bigcommerce/resources/products/custom_field.rb +6 -5
  34. data/lib/bigcommerce/resources/products/google_product_search_mapping.rb +9 -8
  35. data/lib/bigcommerce/resources/products/option.rb +2 -2
  36. data/lib/bigcommerce/resources/products/option_set.rb +2 -2
  37. data/lib/bigcommerce/resources/products/option_set_option.rb +2 -1
  38. data/lib/bigcommerce/resources/products/option_value.rb +1 -0
  39. data/lib/bigcommerce/resources/products/product.rb +61 -61
  40. data/lib/bigcommerce/resources/products/product_image.rb +4 -4
  41. data/lib/bigcommerce/resources/products/product_option.rb +2 -1
  42. data/lib/bigcommerce/resources/products/product_review.rb +1 -5
  43. data/lib/bigcommerce/resources/products/product_rule.rb +4 -4
  44. data/lib/bigcommerce/resources/products/product_video.rb +4 -4
  45. data/lib/bigcommerce/resources/products/sku.rb +15 -9
  46. data/lib/bigcommerce/resources/shipping/shipping_method.rb +2 -1
  47. data/lib/bigcommerce/resources/store/store_information.rb +18 -14
  48. data/lib/bigcommerce/resources/system/time.rb +2 -2
  49. data/lib/bigcommerce/resources/tax/tax_class.rb +2 -1
  50. data/lib/bigcommerce/resources/webhooks/webhook.rb +2 -1
  51. data/lib/bigcommerce/subresource_actions.rb +14 -14
  52. data/lib/bigcommerce/version.rb +1 -1
  53. metadata +47 -166
  54. data/.gitignore +0 -17
  55. data/.rspec +0 -2
  56. data/.rubocop.yml +0 -620
  57. data/.travis.yml +0 -15
  58. data/CHANGELOG.md +0 -11
  59. data/CONTRIBUTING.md +0 -119
  60. data/DEPENDENCIES.md +0 -7
  61. data/Gemfile +0 -15
  62. data/Guardfile +0 -22
  63. data/LICENSE +0 -20
  64. data/RELEASING.md +0 -64
  65. data/Rakefile +0 -13
  66. data/examples/README.md +0 -148
  67. data/examples/configuration/legacy_auth.rb +0 -12
  68. data/examples/configuration/oauth.rb +0 -9
  69. data/examples/content/blog_post.rb +0 -39
  70. data/examples/content/blog_tag.rb +0 -10
  71. data/examples/content/redirect.rb +0 -43
  72. data/examples/customers/customer.rb +0 -36
  73. data/examples/customers/customer_address.rb +0 -50
  74. data/examples/customers/customer_group.rb +0 -35
  75. data/examples/exception_handling.rb +0 -50
  76. data/examples/geography/country.rb +0 -16
  77. data/examples/geography/state.rb +0 -19
  78. data/examples/marketing/coupon.rb +0 -44
  79. data/examples/orders/order.rb +0 -53
  80. data/examples/orders/order_coupon.rb +0 -17
  81. data/examples/orders/order_message.rb +0 -17
  82. data/examples/orders/order_product.rb +0 -23
  83. data/examples/orders/order_shipping_address.rb +0 -23
  84. data/examples/orders/order_status.rb +0 -15
  85. data/examples/orders/order_tax.rb +0 -17
  86. data/examples/orders/shipment.rb +0 -57
  87. data/examples/payments/payment_method.rb +0 -10
  88. data/examples/products/brand.rb +0 -36
  89. data/examples/products/bulk_pricing_rule.rb +0 -47
  90. data/examples/products/category.rb +0 -37
  91. data/examples/products/configurable_field.rb +0 -29
  92. data/examples/products/custom_field.rb +0 -44
  93. data/examples/products/google_product_search_mapping.rb +0 -12
  94. data/examples/products/option.rb +0 -37
  95. data/examples/products/option_set.rb +0 -35
  96. data/examples/products/option_set_option.rb +0 -50
  97. data/examples/products/option_value.rb +0 -43
  98. data/examples/products/product.rb +0 -44
  99. data/examples/products/product_image.rb +0 -42
  100. data/examples/products/product_option.rb +0 -17
  101. data/examples/products/product_review.rb +0 -12
  102. data/examples/products/product_rule.rb +0 -54
  103. data/examples/products/product_video.rb +0 -45
  104. data/examples/products/sku.rb +0 -48
  105. data/examples/shipping/shipping_method.rb +0 -13
  106. data/examples/store/store_info.rb +0 -10
  107. data/examples/system/time.rb +0 -10
  108. data/examples/tax/tax_class.rb +0 -13
  109. data/examples/webhooks/webhook.rb +0 -29
  110. data/spec/bigcommerce/bigcommerce_spec.rb +0 -76
  111. data/spec/bigcommerce/unit/actions_spec.rb +0 -151
  112. data/spec/bigcommerce/unit/exception_spec.rb +0 -53
  113. data/spec/bigcommerce/unit/middleware/auth_spec.rb +0 -18
  114. data/spec/bigcommerce/unit/middleware/http_exception_spec.rb +0 -40
  115. data/spec/bigcommerce/unit/request_spec.rb +0 -180
  116. data/spec/bigcommerce/unit/resources/content/blog_post_spec.rb +0 -12
  117. data/spec/bigcommerce/unit/resources/content/blog_tag_spec.rb +0 -12
  118. data/spec/bigcommerce/unit/resources/content/redirect_spec.rb +0 -12
  119. data/spec/bigcommerce/unit/resources/customers/customer_address_spec.rb +0 -21
  120. data/spec/bigcommerce/unit/resources/customers/customer_group_spec.rb +0 -12
  121. data/spec/bigcommerce/unit/resources/customers/customer_spec.rb +0 -12
  122. data/spec/bigcommerce/unit/resources/geography/country_spec.rb +0 -12
  123. data/spec/bigcommerce/unit/resources/geography/state_spec.rb +0 -21
  124. data/spec/bigcommerce/unit/resources/marketing/coupon_spec.rb +0 -12
  125. data/spec/bigcommerce/unit/resources/orders/order_product_spec.rb +0 -21
  126. data/spec/bigcommerce/unit/resources/orders/order_shipping_address_spec.rb +0 -21
  127. data/spec/bigcommerce/unit/resources/orders/order_spec.rb +0 -13
  128. data/spec/bigcommerce/unit/resources/orders/shipment_spec.rb +0 -21
  129. data/spec/bigcommerce/unit/resources/payments/payment_method_spec.rb +0 -23
  130. data/spec/bigcommerce/unit/resources/products/brand_spec.rb +0 -12
  131. data/spec/bigcommerce/unit/resources/products/bulk_pricing_rule_spec.rb +0 -21
  132. data/spec/bigcommerce/unit/resources/products/category_spec.rb +0 -12
  133. data/spec/bigcommerce/unit/resources/products/configurable_field_spec.rb +0 -21
  134. data/spec/bigcommerce/unit/resources/products/custom_field_spec.rb +0 -21
  135. data/spec/bigcommerce/unit/resources/products/google_product_search_mapping_spec.rb +0 -14
  136. data/spec/bigcommerce/unit/resources/products/option_set_spec.rb +0 -12
  137. data/spec/bigcommerce/unit/resources/products/option_spec.rb +0 -12
  138. data/spec/bigcommerce/unit/resources/products/product_image_spec.rb +0 -21
  139. data/spec/bigcommerce/unit/resources/products/product_review_spec.rb +0 -14
  140. data/spec/bigcommerce/unit/resources/products/product_rule_spec.rb +0 -21
  141. data/spec/bigcommerce/unit/resources/products/product_spec.rb +0 -13
  142. data/spec/bigcommerce/unit/resources/products/product_video_spec.rb +0 -21
  143. data/spec/bigcommerce/unit/resources/products/sku_spec.rb +0 -21
  144. data/spec/bigcommerce/unit/resources/resource_spec.rb +0 -4
  145. data/spec/bigcommerce/unit/resources/store_info/store_information_spec.rb +0 -12
  146. data/spec/bigcommerce/unit/resources/system/time_spec.rb +0 -12
  147. data/spec/bigcommerce/unit/version_spec.rb +0 -7
  148. data/spec/spec_helper.rb +0 -11
@@ -6,45 +6,46 @@ module Bigcommerce
6
6
  class OrderShippingAddress < Resource
7
7
  include Bigcommerce::SubresourceActions.new(
8
8
  uri: 'orders/%d/shipping_addresses/%d',
9
- disable: [:create, :update, :destroy, :destroy_all])
9
+ disable: %i[create update destroy destroy_all]
10
+ )
10
11
 
11
12
  property :id
12
- property :order_id
13
- property :count
14
- property :first_name
15
- property :last_name
16
- property :company
17
- property :street_1
18
- property :street_2
19
- property :city
20
13
  property :zip
21
- property :country
22
- property :country_iso2
23
- property :state
14
+ property :city
24
15
  property :email
25
16
  property :phone
26
- property :items_total
27
- property :items_shipped
28
- property :shipping_method
17
+ property :state
18
+ property :company
19
+ property :country
20
+ property :cost_tax
21
+ property :order_id
22
+ property :street_1
23
+ property :street_2
29
24
  property :base_cost
25
+ property :last_name
26
+ property :first_name
30
27
  property :cost_ex_tax
28
+ property :items_total
31
29
  property :cost_inc_tax
32
- property :cost_tax
30
+ property :country_iso2
31
+ property :items_shipped
32
+ property :shipping_method
33
+ property :shipping_zone_id
33
34
  property :cost_tax_class_id
35
+ property :handling_cost_tax
34
36
  property :base_handling_cost
37
+ property :shipping_zone_name
35
38
  property :handling_cost_ex_tax
36
39
  property :handling_cost_inc_tax
37
- property :handling_cost_tax
38
40
  property :handling_cost_tax_class_id
39
- property :shipping_zone_id
40
- property :shipping_zone_name
41
+ property :count
41
42
 
42
- def self.count(order_id)
43
- get "orders/#{order_id}/shipping_addresses/count"
43
+ def self.count(order_id, params = {})
44
+ get "orders/#{order_id}/shipping_addresses/count", params
44
45
  end
45
46
 
46
- def self.count_all
47
- get 'orders/shipping_addresses/count'
47
+ def self.count_all(params = {})
48
+ get 'orders/shipping_addresses/count', params
48
49
  end
49
50
  end
50
51
  end
@@ -7,7 +7,8 @@ module Bigcommerce
7
7
  class OrderStatus < Resource
8
8
  include Bigcommerce::ResourceActions.new(
9
9
  uri: 'order_statuses/%d',
10
- disable: [:create, :update, :destroy, :destroy_all])
10
+ disable: %i[create update destroy destroy_all]
11
+ )
11
12
 
12
13
  property :id
13
14
  property :name
@@ -6,18 +6,19 @@ module Bigcommerce
6
6
  class OrderTax < Resource
7
7
  include Bigcommerce::SubresourceActions.new(
8
8
  uri: 'orders/%d/taxes/%d',
9
- disable: [:create, :update, :destroy, :destroy_all])
9
+ disable: %i[create update destroy destroy_all]
10
+ )
10
11
 
11
12
  property :id
12
- property :order_id
13
- property :order_address_id
14
- property :tax_rate_id
15
- property :tax_class_id
16
13
  property :name
17
- property :tax_class, from: :class
18
14
  property :rate
15
+ property :tax_class, from: :class
16
+ property :order_id
19
17
  property :priority
20
- property :priority_amount
21
18
  property :line_amount
19
+ property :tax_rate_id
20
+ property :tax_class_id
21
+ property :priority_amount
22
+ property :order_address_id
22
23
  end
23
24
  end
@@ -7,24 +7,25 @@ module Bigcommerce
7
7
  include Bigcommerce::SubresourceActions.new uri: 'orders/%d/shipments/%d'
8
8
 
9
9
  property :id
10
+ property :items
11
+ property :comments
10
12
  property :order_id
11
- property :count
12
13
  property :customer_id
13
- property :order_address_id
14
14
  property :date_created
15
- property :tracking_number
16
- property :shipping_method
17
- property :comments
18
15
  property :billing_address
16
+ property :shipping_method
17
+ property :tracking_number
18
+ property :order_address_id
19
19
  property :shipping_address
20
- property :items
20
+ property :shipping_provider
21
+ property :count
21
22
 
22
- def self.count(order_id)
23
- get "orders/#{order_id}/shipments/count"
23
+ def self.count(order_id, params = {})
24
+ get "orders/#{order_id}/shipments/count", params
24
25
  end
25
26
 
26
- def self.count_all
27
- get 'orders/shipments/count'
27
+ def self.count_all(params = {})
28
+ get 'orders/shipments/count', params
28
29
  end
29
30
  end
30
31
  end
@@ -16,8 +16,8 @@ module Bigcommerce
16
16
  property :image_file
17
17
  property :search_keywords
18
18
 
19
- def self.count
20
- get 'brands/count'
19
+ def self.count(params = {})
20
+ get 'brands/count', params
21
21
  end
22
22
  end
23
23
  end
@@ -5,7 +5,8 @@
5
5
  module Bigcommerce
6
6
  class BulkPricingRule < Resource
7
7
  include Bigcommerce::SubresourceActions.new(
8
- uri: 'products/%d/discount_rules/%d')
8
+ uri: 'products/%d/discount_rules/%d'
9
+ )
9
10
 
10
11
  property :id
11
12
  property :count
@@ -15,12 +16,12 @@ module Bigcommerce
15
16
  property :type
16
17
  property :type_value
17
18
 
18
- def self.count(product_id)
19
- get "products/#{product_id}/discount_rules/count"
19
+ def self.count(product_id, params = {})
20
+ get "products/#{product_id}/discount_rules/count", params
20
21
  end
21
22
 
22
- def self.count_all
23
- get 'products/discount_rules/count'
23
+ def self.count_all(params = {})
24
+ get 'products/discount_rules/count', params
24
25
  end
25
26
  end
26
27
  end
@@ -22,8 +22,8 @@ module Bigcommerce
22
22
  property :search_keywords
23
23
  property :url
24
24
 
25
- def self.count
26
- get 'categories/count'
25
+ def self.count(params = {})
26
+ get 'categories/count', params
27
27
  end
28
28
  end
29
29
  end
@@ -6,7 +6,8 @@ module Bigcommerce
6
6
  class ConfigurableField < Resource
7
7
  include Bigcommerce::SubresourceActions.new(
8
8
  uri: 'products/%d/configurable_fields/%d',
9
- disable: [:create, :update])
9
+ disable: %i[create update]
10
+ )
10
11
 
11
12
  property :id
12
13
  property :product_id
@@ -19,12 +20,12 @@ module Bigcommerce
19
20
  property :is_required
20
21
  property :sort_order
21
22
 
22
- def self.count(product_id)
23
- get "products/#{product_id}/configurable_fields/count"
23
+ def self.count(product_id, params = {})
24
+ get "products/#{product_id}/configurable_fields/count", params
24
25
  end
25
26
 
26
- def self.count_all
27
- get 'products/configurable_fields/count'
27
+ def self.count_all(params = {})
28
+ get 'products/configurable_fields/count', params
28
29
  end
29
30
  end
30
31
  end
@@ -5,7 +5,8 @@
5
5
  module Bigcommerce
6
6
  class CustomField < Resource
7
7
  include Bigcommerce::SubresourceActions.new(
8
- uri: 'products/%d/custom_fields/%d')
8
+ uri: 'products/%d/custom_fields/%d'
9
+ )
9
10
 
10
11
  property :id
11
12
  property :product_id
@@ -13,12 +14,12 @@ module Bigcommerce
13
14
  property :name
14
15
  property :text
15
16
 
16
- def self.count(product_id)
17
- get "products/#{product_id}/custom_fields/count"
17
+ def self.count(product_id, params = {})
18
+ get "products/#{product_id}/custom_fields/count", params
18
19
  end
19
20
 
20
- def self.count_all
21
- get 'products/custom_fields/count'
21
+ def self.count_all(params = {})
22
+ get 'products/custom_fields/count', params
22
23
  end
23
24
  end
24
25
  end
@@ -6,21 +6,22 @@ module Bigcommerce
6
6
  class GoogleProductSearchMapping < Resource
7
7
  include Bigcommerce::Request.new 'products/%d/googleproductsearch'
8
8
 
9
+ property :size
10
+ property :color
11
+ property :gender
9
12
  property :enabled
13
+ property :pattern
14
+ property :material
15
+ property :age_group
10
16
  property :product_id
11
17
  property :category_id
12
18
  property :custom_item
13
19
  property :global_trade_item_number
14
20
  property :manufacturer_part_number
15
- property :gender
16
- property :age_group
17
- property :color
18
- property :size
19
- property :material
20
- property :pattern
21
+ property :google_shopping_product_category_path
21
22
 
22
- def self.all(product_id)
23
- get path.build(product_id)
23
+ def self.all(product_id, params = {})
24
+ get path.build(product_id), params
24
25
  end
25
26
  end
26
27
  end
@@ -13,8 +13,8 @@ module Bigcommerce
13
13
  property :type
14
14
  property :values
15
15
 
16
- def self.count
17
- get 'options/count'
16
+ def self.count(params = {})
17
+ get 'options/count', params
18
18
  end
19
19
  end
20
20
  end
@@ -11,8 +11,8 @@ module Bigcommerce
11
11
  property :count
12
12
  property :options
13
13
 
14
- def self.count
15
- get 'option_sets/count'
14
+ def self.count(params = {})
15
+ get 'option_sets/count', params
16
16
  end
17
17
  end
18
18
  end
@@ -5,7 +5,8 @@
5
5
  module Bigcommerce
6
6
  class OptionSetOption < Resource
7
7
  include Bigcommerce::SubresourceActions.new(
8
- uri: 'option_sets/%d/options/%d')
8
+ uri: 'option_sets/%d/options/%d'
9
+ )
9
10
 
10
11
  property :id
11
12
  property :option_id
@@ -11,5 +11,6 @@ module Bigcommerce
11
11
  property :label
12
12
  property :sort_order
13
13
  property :value
14
+ property :is_default
14
15
  end
15
16
  end
@@ -7,88 +7,88 @@ module Bigcommerce
7
7
  include Bigcommerce::ResourceActions.new uri: 'products/%d'
8
8
 
9
9
  property :id
10
- property :count
11
- property :keyword_filter
10
+ property :sku
11
+ property :upc
12
12
  property :name
13
+ property :skus
13
14
  property :type
14
- property :sku
15
- property :description
16
- property :search_keywords
17
- property :availability_description
15
+ property :brand
16
+ property :depth
18
17
  property :price
18
+ property :rules
19
+ property :width
20
+ property :height
21
+ property :images
22
+ property :videos
23
+ property :weight
24
+ property :options
25
+ property :brand_id
26
+ property :warranty
27
+ property :condition
28
+ property :downloads
29
+ property :tax_class
30
+ property :categories
19
31
  property :cost_price
20
- property :retail_price
32
+ property :custom_url
33
+ property :is_visible
34
+ property :option_set
35
+ property :page_title
21
36
  property :sale_price
22
- property :calculated_price
23
37
  property :sort_order
24
- property :is_visible
25
- property :is_featured
26
- property :related_products
27
- property :inventory_level
28
- property :inventory_warning_level
29
- property :warranty
30
- property :weight
31
- property :width
32
- property :height
33
- property :depth
34
- property :fixed_cost_shipping_price
35
- property :is_free_shipping
36
- property :inventory_tracking
37
- property :rating_total
38
- property :rating_count
39
38
  property :total_sold
40
- property :date_created
41
- property :brand_id
42
39
  property :view_count
43
- property :page_title
44
- property :meta_keywords
45
- property :meta_description
40
+ property :description
41
+ property :is_featured
46
42
  property :layout_file
47
- property :is_price_hidden
48
- property :price_hidden_label
49
- property :categories
43
+ property :availability
44
+ property :date_created
45
+ property :rating_count
46
+ property :rating_total
47
+ property :retail_price
48
+ property :tax_class_id
49
+ property :custom_fields
50
50
  property :date_modified
51
- property :event_date_field_name
51
+ property :meta_keywords
52
+ property :option_set_id
53
+ property :discount_rules
54
+ property :event_date_end
55
+ property :keyword_filter
52
56
  property :event_date_type
57
+ property :inventory_level
58
+ property :is_price_hidden
59
+ property :open_graph_type
60
+ property :search_keywords
61
+ property :calculated_price
53
62
  property :event_date_start
54
- property :event_date_end
63
+ property :is_free_shipping
64
+ property :is_preorder_only
65
+ property :meta_description
66
+ property :open_graph_title
67
+ property :preorder_message
68
+ property :related_products
69
+ property :bin_picking_number
70
+ property :date_last_imported
71
+ property :inventory_tracking
72
+ property :is_condition_shown
55
73
  property :myob_asset_account
74
+ property :option_set_display
75
+ property :price_hidden_label
76
+ property :configurable_fields
56
77
  property :myob_income_account
57
78
  property :myob_expense_account
58
79
  property :peachtree_gl_account
59
- property :condition
60
- property :is_condition_shown
80
+ property :event_date_field_name
61
81
  property :preorder_release_date
62
- property :is_preorder_only
63
- property :preorder_message
64
- property :order_quantity_minimum
65
- property :order_quantity_maximum
66
- property :open_graph_type
67
- property :open_graph_title
68
82
  property :open_graph_description
83
+ property :order_quantity_maximum
84
+ property :order_quantity_minimum
85
+ property :inventory_warning_level
69
86
  property :is_open_graph_thumbnail
70
- property :upc
71
- property :date_last_imported
72
- property :option_set_id
73
- property :tax_class_id
74
- property :option_set_display
75
- property :bin_picking_number
76
- property :custom_url
77
- property :availability
78
- property :brand
79
- property :downloads
80
- property :images
81
- property :discount_rules
82
- property :configurable_fields
83
- property :custom_fields
84
- property :videos
85
- property :skus
86
- property :rules
87
- property :option_set
88
- property :options
89
- property :tax_class
87
+ property :availability_description
90
88
  property :avalara_product_tax_code
89
+ property :fixed_cost_shipping_price
91
90
  property :primary_image
91
+ property :count
92
92
 
93
93
  def self.count(params = {})
94
94
  get 'products/count', params