spree-api-client 0.0.1 → 0.2.3

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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/LICENSE.txt +674 -0
  4. data/README.md +31 -38
  5. data/lib/spree_client.rb +3 -0
  6. data/lib/spree_client.rb~ +71 -0
  7. data/lib/spree_client/api.rb +1 -0
  8. data/lib/spree_client/api/v1.rb +53 -0
  9. data/lib/spree_client/api/v1/products.rb +23 -0
  10. data/lib/spree_client/api/v1/properties.rb +12 -0
  11. data/lib/spree_client/api/v1/resources.rb +142 -0
  12. data/lib/spree_client/api/v1/stock_items.rb +27 -0
  13. data/lib/spree_client/api/v1/stock_locations.rb +33 -0
  14. data/lib/spree_client/api/v1/stock_movements.rb +16 -0
  15. data/lib/spree_client/api/v1/taxonomies.rb +12 -0
  16. data/lib/spree_client/api/v1/variants.rb +13 -0
  17. data/lib/spree_client/attributes.rb +27 -0
  18. data/lib/spree_client/models.rb +5 -0
  19. data/lib/spree_client/models/product.rb +7 -0
  20. data/lib/spree_client/models/property.rb +6 -0
  21. data/lib/spree_client/models/stock_item.rb +7 -0
  22. data/lib/spree_client/models/stock_location.rb +7 -0
  23. data/lib/spree_client/models/stock_movement.rb +7 -0
  24. data/lib/spree_client/models/store.rb +7 -0
  25. data/lib/spree_client/models/taxonomy.rb +5 -0
  26. data/lib/spree_client/models/variant.rb +7 -0
  27. metadata +79 -118
  28. data/.gitignore +0 -17
  29. data/.travis.yml +0 -9
  30. data/CONTRIBUTING.md +0 -8
  31. data/Gemfile +0 -3
  32. data/LICENSE +0 -22
  33. data/Rakefile +0 -7
  34. data/lib/spree-api-client.rb +0 -49
  35. data/lib/spree-api-client/addresses.rb +0 -15
  36. data/lib/spree-api-client/connection.rb +0 -30
  37. data/lib/spree-api-client/countries.rb +0 -15
  38. data/lib/spree-api-client/line_items.rb +0 -19
  39. data/lib/spree-api-client/orders.rb +0 -31
  40. data/lib/spree-api-client/payments.rb +0 -43
  41. data/lib/spree-api-client/products.rb +0 -31
  42. data/lib/spree-api-client/properties.rb +0 -31
  43. data/lib/spree-api-client/request.rb +0 -49
  44. data/lib/spree-api-client/return_authorizations.rb +0 -31
  45. data/lib/spree-api-client/shipments.rb +0 -15
  46. data/lib/spree-api-client/taxonomies.rb +0 -31
  47. data/lib/spree-api-client/taxons.rb +0 -27
  48. data/lib/spree-api-client/variants.rb +0 -31
  49. data/lib/spree-api-client/version.rb +0 -7
  50. data/lib/spree-api-client/zones.rb +0 -31
  51. data/spec/addresses_spec.rb +0 -11
  52. data/spec/client_spec.rb +0 -31
  53. data/spec/countries_spec.rb +0 -11
  54. data/spec/orders_spec.rb +0 -11
  55. data/spec/payments_spec.rb +0 -11
  56. data/spec/products_spec.rb +0 -11
  57. data/spec/properties_spec.rb +0 -11
  58. data/spec/return_authorizations_spec.rb +0 -11
  59. data/spec/shipments_spec.rb +0 -11
  60. data/spec/spec_helper.rb +0 -5
  61. data/spec/taxonomies_spec.rb +0 -11
  62. data/spec/taxons_spec.rb +0 -11
  63. data/spec/variants_spec.rb +0 -11
  64. data/spec/zones_spec.rb +0 -11
  65. data/spree-api-client.gemspec +0 -27
@@ -0,0 +1,16 @@
1
+ module SpreeClient
2
+ module API
3
+ class V1
4
+ # Stock Movements
5
+ # @see SpreeClient::API:V1::Resources
6
+ class StockMovements < Resources
7
+ ENDPOINT = '/api/v1/stock_locations/:stock_location_id/stock_movements'
8
+ RESOURCE = SpreeClient::Models::StockMovement
9
+ NAME = 'stock_movement'
10
+
11
+ def update(_); end
12
+ def destroy(_); end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ class SpreeClient
2
+ module API
3
+ class V1
4
+ # Taxonomies
5
+ # @see SpreeClient::API:V1::Resource
6
+ class Taxonomies < Resources
7
+ ENDPOINT = '/api/v1/taxonomies'
8
+ RESOURCE = Taxonomy
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module SpreeClient
2
+ module API
3
+ class V1
4
+ # Variants
5
+ # @see SpreeClient::API:V1::Resource
6
+ class Variants < Resources
7
+ ENDPOINT = '/api/v1/variants'
8
+ RESOURCE = SpreeClient::Models::Variant
9
+ NAME = 'variant'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,27 @@
1
+ module SpreeClient
2
+ # @see Spree::PermittedAttributes
3
+ class Attributes
4
+ PRODUCT = %i[id name description available_on discontinue_on
5
+ permalink meta_description meta_keywords meta_title
6
+ price sku deleted_at prototype_id option_values_hash
7
+ weight height width depth shipping_category_id
8
+ tax_category_id cost_currency cost_price
9
+ option_type_ids taxon_ids pay_what_you_can].freeze
10
+
11
+ VARIANT = %i[id name presentation cost_price discontinue_on
12
+ lock_version position track_inventory product_id
13
+ product option_values_attributes price weight height
14
+ width depth sku cost_currency options
15
+ option_value_ids].freeze
16
+
17
+ STOCK_LOCATION = %i[name active address1 address2 city zipcode
18
+ backorderable_default state_name state_id
19
+ country_id phone propagate_all_variants].freeze
20
+
21
+ STOCK_ITEM = %i[stock_location_id variant stock_location backorderable variant_id].freeze
22
+
23
+ STOCK_MOVEMENT = %i[id stock_location_id quantity stock_item
24
+ stock_item_id originator action].freeze
25
+
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ require_relative 'models/product'
2
+ require_relative 'models/variant'
3
+ require_relative 'models/stock_location'
4
+ require_relative 'models/stock_item'
5
+ require_relative 'models/stock_movement'
@@ -0,0 +1,7 @@
1
+ module SpreeClient
2
+ module Models
3
+ # @see Spree::Product
4
+ # @see SpreeClient::Attributes
5
+ Product = Struct.new *Attributes::PRODUCT, keyword_init: true
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # @see Spree::Property
2
+ Property = Struct.new :id, :name, :presentation, keyword_init: true do
3
+ def to_s
4
+ 'property'.freeze
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module SpreeClient
2
+ module Models
3
+ # @see Spree::StockItem
4
+ # @see SpreeClient::Attributes
5
+ StockItem = Struct.new *Attributes::STOCK_ITEM, keyword_init: true
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module SpreeClient
2
+ module Models
3
+ # @see Spree::StockLocation
4
+ # @see SpreeClient::Attributes
5
+ StockLocation = Struct.new *Attributes::STOCK_LOCATION, keyword_init: true
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module SpreeClient
2
+ module Models
3
+ # @see Spree::StockMovement
4
+ # @see SpreeClient::Attributes
5
+ StockMovement = Struct.new *Attributes::STOCK_MOVEMENT, keyword_init: true
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # Stores are different frontends for the same backend.
2
+ #
3
+ # @see {https://guides.spreecommerce.org/user/configuration/configuring_multi_stores.html}
4
+ Store = Struct.new :id, :name, :url,
5
+ :seo_title, :meta_description, :meta_keywords,
6
+ :mail_from_address, :default_currency,
7
+ :facebook, :twitter, :instagram, keyword_init: true
@@ -0,0 +1,5 @@
1
+ Taxonomy = Struct.new :id, :name, keyword_init: true do
2
+ def to_s
3
+ 'taxonomy'.freeze
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module SpreeClient
2
+ module Models
3
+ # @see Spree::Variant
4
+ # @see SpreeClient::Attributes
5
+ Variant = Struct.new *Attributes::VARIANT, keyword_init: true
6
+ end
7
+ end
metadata CHANGED
@@ -1,164 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
- - Andrew Nesbitt
9
- autorequire:
7
+ - f
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: faraday
16
- requirement: &70322126250800 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0.8'
19
+ version: 0.18.0
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70322126250800
25
- - !ruby/object:Gem::Dependency
26
- name: faraday_middleware
27
- requirement: &70322126263240 !ruby/object:Gem::Requirement
28
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
- - - ~>
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '0.9'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *70322126263240
26
+ version: 0.18.0
36
27
  - !ruby/object:Gem::Dependency
37
- name: hashie
38
- requirement: &70322126262760 !ruby/object:Gem::Requirement
39
- none: false
28
+ name: fast_blank
29
+ requirement: !ruby/object:Gem::Requirement
40
30
  requirements:
41
- - - ~>
31
+ - - "~>"
42
32
  - !ruby/object:Gem::Version
43
- version: '1.2'
33
+ version: '1'
44
34
  type: :runtime
45
35
  prerelease: false
46
- version_requirements: *70322126262760
47
- - !ruby/object:Gem::Dependency
48
- name: multi_json
49
- requirement: &70322126261720 !ruby/object:Gem::Requirement
50
- none: false
36
+ version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ~>
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '1.3'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: *70322126261720
40
+ version: '1'
58
41
  - !ruby/object:Gem::Dependency
59
- name: rake
60
- requirement: &70322126260140 !ruby/object:Gem::Requirement
61
- none: false
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
62
44
  requirements:
63
- - - ! '>='
45
+ - - ">="
64
46
  - !ruby/object:Gem::Version
65
47
  version: '0'
66
48
  type: :development
67
49
  prerelease: false
68
- version_requirements: *70322126260140
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: &70322126257560 !ruby/object:Gem::Requirement
72
- none: false
50
+ version_requirements: !ruby/object:Gem::Requirement
73
51
  requirements:
74
- - - ! '>='
52
+ - - ">="
75
53
  - !ruby/object:Gem::Version
76
54
  version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *70322126257560
80
- description: A rubygem for interacting with the Spree API
55
+ description: This is a work in progress!
81
56
  email:
82
- - andrewnez@gmail.com
57
+ - f@sutty.nl
83
58
  executables: []
84
59
  extensions: []
85
- extra_rdoc_files: []
60
+ extra_rdoc_files:
61
+ - README.md
62
+ - CHANGELOG.md
63
+ - LICENSE.txt
86
64
  files:
87
- - .gitignore
88
- - .travis.yml
89
- - CONTRIBUTING.md
90
- - Gemfile
91
- - LICENSE
65
+ - CHANGELOG.md
66
+ - LICENSE.txt
67
+ - README.md
68
+ - lib/spree_client.rb
69
+ - lib/spree_client.rb~
70
+ - lib/spree_client/api.rb
71
+ - lib/spree_client/api/v1.rb
72
+ - lib/spree_client/api/v1/products.rb
73
+ - lib/spree_client/api/v1/properties.rb
74
+ - lib/spree_client/api/v1/resources.rb
75
+ - lib/spree_client/api/v1/stock_items.rb
76
+ - lib/spree_client/api/v1/stock_locations.rb
77
+ - lib/spree_client/api/v1/stock_movements.rb
78
+ - lib/spree_client/api/v1/taxonomies.rb
79
+ - lib/spree_client/api/v1/variants.rb
80
+ - lib/spree_client/attributes.rb
81
+ - lib/spree_client/models.rb
82
+ - lib/spree_client/models/product.rb
83
+ - lib/spree_client/models/property.rb
84
+ - lib/spree_client/models/stock_item.rb
85
+ - lib/spree_client/models/stock_location.rb
86
+ - lib/spree_client/models/stock_movement.rb
87
+ - lib/spree_client/models/store.rb
88
+ - lib/spree_client/models/taxonomy.rb
89
+ - lib/spree_client/models/variant.rb
90
+ homepage: https://0xacab.org/sutty/spree-api-client
91
+ licenses:
92
+ - GPL-3.0
93
+ metadata:
94
+ bug_tracker_uri: https://0xacab.org/sutty/spree-api-client/issues
95
+ homepage_uri: https://0xacab.org/sutty/spree-api-client
96
+ source_code_uri: https://0xacab.org/sutty/spree-api-client
97
+ changelog_uri: https://0xacab.org/sutty/spree-api-client/-/blob/master/CHANGELOG.md
98
+ documentation_uri: https://rubydoc.info/gems/spree-api-client
99
+ post_install_message:
100
+ rdoc_options:
101
+ - "--title"
102
+ - spree-api-client - Spree Ecommerce API client
103
+ - "--main"
92
104
  - README.md
93
- - Rakefile
94
- - lib/spree-api-client.rb
95
- - lib/spree-api-client/addresses.rb
96
- - lib/spree-api-client/connection.rb
97
- - lib/spree-api-client/countries.rb
98
- - lib/spree-api-client/line_items.rb
99
- - lib/spree-api-client/orders.rb
100
- - lib/spree-api-client/payments.rb
101
- - lib/spree-api-client/products.rb
102
- - lib/spree-api-client/properties.rb
103
- - lib/spree-api-client/request.rb
104
- - lib/spree-api-client/return_authorizations.rb
105
- - lib/spree-api-client/shipments.rb
106
- - lib/spree-api-client/taxonomies.rb
107
- - lib/spree-api-client/taxons.rb
108
- - lib/spree-api-client/variants.rb
109
- - lib/spree-api-client/version.rb
110
- - lib/spree-api-client/zones.rb
111
- - spec/addresses_spec.rb
112
- - spec/client_spec.rb
113
- - spec/countries_spec.rb
114
- - spec/orders_spec.rb
115
- - spec/payments_spec.rb
116
- - spec/products_spec.rb
117
- - spec/properties_spec.rb
118
- - spec/return_authorizations_spec.rb
119
- - spec/shipments_spec.rb
120
- - spec/spec_helper.rb
121
- - spec/taxonomies_spec.rb
122
- - spec/taxons_spec.rb
123
- - spec/variants_spec.rb
124
- - spec/zones_spec.rb
125
- - spree-api-client.gemspec
126
- homepage: https://github.com/andrew/spree-api-client
127
- licenses: []
128
- post_install_message:
129
- rdoc_options: []
105
+ - "--line-numbers"
106
+ - "--inline-source"
107
+ - "--quiet"
130
108
  require_paths:
131
109
  - lib
132
110
  required_ruby_version: !ruby/object:Gem::Requirement
133
- none: false
134
111
  requirements:
135
- - - ! '>='
112
+ - - ">="
136
113
  - !ruby/object:Gem::Version
137
- version: '0'
114
+ version: 2.6.0
138
115
  required_rubygems_version: !ruby/object:Gem::Requirement
139
- none: false
140
116
  requirements:
141
- - - ! '>='
117
+ - - ">="
142
118
  - !ruby/object:Gem::Version
143
119
  version: '0'
144
120
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 1.8.11
147
- signing_key:
148
- specification_version: 3
149
- summary: A rubygem for interacting with the Spree API
150
- test_files:
151
- - spec/addresses_spec.rb
152
- - spec/client_spec.rb
153
- - spec/countries_spec.rb
154
- - spec/orders_spec.rb
155
- - spec/payments_spec.rb
156
- - spec/products_spec.rb
157
- - spec/properties_spec.rb
158
- - spec/return_authorizations_spec.rb
159
- - spec/shipments_spec.rb
160
- - spec/spec_helper.rb
161
- - spec/taxonomies_spec.rb
162
- - spec/taxons_spec.rb
163
- - spec/variants_spec.rb
164
- - spec/zones_spec.rb
121
+ rubygems_version: 3.1.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Spree Ecommerce API client
125
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.8.7
4
- - 1.9.2
5
- - 1.9.3
6
- - jruby-18mode # JRuby in 1.8 mode
7
- - jruby-19mode # JRuby in 1.9 mode
8
- - rbx-18mode
9
- - rbx-19mode
data/CONTRIBUTING.md DELETED
@@ -1,8 +0,0 @@
1
- ## Contributing
2
- * Fork the project.
3
- * Make your feature addition or bug fix.
4
- * Add tests for it. This is important so I don't break it in a
5
- future version unintentionally.
6
- * Commit, do not mess with rakefile, version, or history.
7
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
8
- * Send a pull request. Bonus points for topic branches.
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012 Andrew Nesbitt
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.