veeqo_api_ruby 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +55 -0
- data/lib/veeqo.rb +27 -0
- data/lib/veeqo/config.rb +11 -0
- data/lib/veeqo/connection.rb +17 -0
- data/lib/veeqo/exception.rb +58 -0
- data/lib/veeqo/middleware/auth.rb +15 -0
- data/lib/veeqo/middleware/http_exception.rb +14 -0
- data/lib/veeqo/request.rb +88 -0
- data/lib/veeqo/resource_actions.rb +51 -0
- data/lib/veeqo/resources/channel.rb +71 -0
- data/lib/veeqo/resources/company.rb +22 -0
- data/lib/veeqo/resources/customer.rb +17 -0
- data/lib/veeqo/resources/delivery_method.rb +16 -0
- data/lib/veeqo/resources/order.rb +51 -0
- data/lib/veeqo/resources/product.rb +46 -0
- data/lib/veeqo/resources/purchase_order.rb +34 -0
- data/lib/veeqo/resources/resource.rb +10 -0
- data/lib/veeqo/resources/supplier.rb +35 -0
- data/lib/veeqo/resources/warehouse.rb +31 -0
- data/lib/veeqo/subresource_actions.rb +43 -0
- data/lib/veeqo/version.rb +3 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d89f532e9a482385d86d41f4a42a9ca9064bc49
|
4
|
+
data.tar.gz: b5abe9360c21f2a23de53e449c997fbe286285b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3a27ae249ad58cac59c3a95675ca7d1de8449c093f7884b8528f2e357f365cb7327119527d868b24a8aaa2c8436521fb31abec4703c3d5d0ba36d719af296e2e
|
7
|
+
data.tar.gz: d8b04a6402367408da4c740114c39c5b4f208980001b2e21506f6a1de85823e5b2997cf4612007d0b8df79a974ae56dca3833080427813ab0ff3f4b5cdfe44e8
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# VeeqoApiRuby
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/veeqo_api_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'veeqo_api_ruby'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install veeqo_api_ruby
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
For full examples of using the API client, please see the [examples folder](examples) and refer to Veeqo [developer documentation](https://developers.veeqo.com/docs/versions/1-0-0-beta).
|
26
|
+
|
27
|
+
Example:
|
28
|
+
|
29
|
+
```rb
|
30
|
+
# Configure the client to talk to a given store
|
31
|
+
Veeqo.configure do |config|
|
32
|
+
config.api_key = ENV['VEEQO_API_KEY']
|
33
|
+
end
|
34
|
+
|
35
|
+
# Make an API request for a given resource
|
36
|
+
Veeqo::Company.info
|
37
|
+
=> #<Veeqo::Company id=1234>
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
## Development
|
42
|
+
|
43
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
44
|
+
|
45
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/veeqo_api_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
50
|
+
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
55
|
+
|
data/lib/veeqo.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'veeqo/version'
|
4
|
+
require 'veeqo/config'
|
5
|
+
require 'veeqo/connection'
|
6
|
+
require 'veeqo/exception'
|
7
|
+
require 'veeqo/request'
|
8
|
+
require 'veeqo/resource_actions'
|
9
|
+
require 'veeqo/subresource_actions'
|
10
|
+
require 'veeqo/middleware/auth'
|
11
|
+
require 'veeqo/middleware/http_exception'
|
12
|
+
require 'veeqo/resources/resource'
|
13
|
+
|
14
|
+
module Veeqo
|
15
|
+
resources = File.join(File.dirname(__FILE__), 'veeqo', 'resources', '**', '*.rb')
|
16
|
+
Dir.glob(resources, &method(:require))
|
17
|
+
|
18
|
+
class << self
|
19
|
+
attr_reader :api, :config
|
20
|
+
|
21
|
+
def configure
|
22
|
+
@config = Veeqo::Config.new.tap { |h| yield(h) }
|
23
|
+
@api = Veeqo::Connection.build(@config)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
# Your code goes here...
|
27
|
+
end
|
data/lib/veeqo/config.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Veeqo
|
2
|
+
module Connection
|
3
|
+
HEADERS = {
|
4
|
+
'accept' => 'application/json'
|
5
|
+
}.freeze
|
6
|
+
|
7
|
+
def self.build(config)
|
8
|
+
Faraday.new(url: config.api_url) do |conn|
|
9
|
+
conn.request :json
|
10
|
+
conn.headers = HEADERS
|
11
|
+
conn.use Veeqo::Middleware::Auth, config
|
12
|
+
conn.use Veeqo::Middleware::HttpException
|
13
|
+
conn.adapter Faraday.default_adapter
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Veeqo
|
2
|
+
class HttpError < StandardError
|
3
|
+
attr_accessor :response_headers
|
4
|
+
def initialize(headers)
|
5
|
+
@response_headers = headers
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class BadRequest < HttpError; end
|
10
|
+
class Unauthorized < HttpError; end
|
11
|
+
class Forbidden < HttpError; end
|
12
|
+
class NotFound < HttpError; end
|
13
|
+
class MethodNotAllowed < HttpError; end
|
14
|
+
class NotAccepted < HttpError; end
|
15
|
+
class TimeOut < HttpError; end
|
16
|
+
class ResourceConflict < HttpError; end
|
17
|
+
class TooManyRequests < HttpError; end
|
18
|
+
class InternalServerError < HttpError; end
|
19
|
+
class BadGateway < HttpError; end
|
20
|
+
class ServiceUnavailable < HttpError; end
|
21
|
+
class GatewayTimeout < HttpError; end
|
22
|
+
class BandwidthLimitExceeded < HttpError; end
|
23
|
+
|
24
|
+
module HttpErrors
|
25
|
+
ERRORS = {
|
26
|
+
400 => Veeqo::BadRequest,
|
27
|
+
401 => Veeqo::Unauthorized,
|
28
|
+
403 => Veeqo::Forbidden,
|
29
|
+
404 => Veeqo::NotFound,
|
30
|
+
405 => Veeqo::MethodNotAllowed,
|
31
|
+
406 => Veeqo::NotAccepted,
|
32
|
+
408 => Veeqo::TimeOut,
|
33
|
+
409 => Veeqo::ResourceConflict,
|
34
|
+
429 => Veeqo::TooManyRequests,
|
35
|
+
500 => Veeqo::InternalServerError,
|
36
|
+
502 => Veeqo::BadGateway,
|
37
|
+
503 => Veeqo::ServiceUnavailable,
|
38
|
+
504 => Veeqo::GatewayTimeout,
|
39
|
+
509 => Veeqo::BandwidthLimitExceeded
|
40
|
+
}.freeze
|
41
|
+
|
42
|
+
def throw_http_exception!(code, env)
|
43
|
+
return unless ERRORS.keys.include? code
|
44
|
+
response_headers = {}
|
45
|
+
unless env.body.empty?
|
46
|
+
response_headers = begin
|
47
|
+
JSON.parse(env.body, symbolize_names: true)
|
48
|
+
rescue
|
49
|
+
{}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
unless env[:response_headers] && env[:response_headers]['X-Retry-After'].nil?
|
53
|
+
response_headers[:retry_after] = env[:response_headers]['X-Retry-After'].to_i
|
54
|
+
end
|
55
|
+
raise ERRORS[code].new(response_headers), env.body
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Veeqo
|
2
|
+
module Middleware
|
3
|
+
class Auth < Faraday::Middleware
|
4
|
+
def initialize(app, options = {})
|
5
|
+
@app = app
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:request_headers]['x-api-key'] = @options[:api_key]
|
11
|
+
@app.call env
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Veeqo
|
4
|
+
class PathBuilder
|
5
|
+
attr_reader :uri
|
6
|
+
|
7
|
+
def initialize(uri)
|
8
|
+
@uri = uri
|
9
|
+
end
|
10
|
+
|
11
|
+
# This takes the @uri and inserts the keys to form a path.
|
12
|
+
# To start we make sure that for nil/numeric values, we wrap those into an
|
13
|
+
# array. We then scan the string for %d and %s to find the number of times
|
14
|
+
# we possibly need to insert keys into the URI. Next, we check the size of
|
15
|
+
# the keys array, if the keys size is less than the number of possible keys
|
16
|
+
# in the URI, we will remove the trailing %d or %s, then remove the
|
17
|
+
# trailing /. We then pass the keys into the uri to form the path.
|
18
|
+
# ex. foo/%d/bar/%d => foo/1/bar/2
|
19
|
+
def build(keys = [])
|
20
|
+
keys = [] if keys.nil?
|
21
|
+
keys = [keys] if keys.is_a? Numeric
|
22
|
+
ids = uri.scan('%d').count + uri.scan('%s').count
|
23
|
+
str = ids > keys.size ? uri.chomp('%d').chomp('%s').chomp('/') : uri
|
24
|
+
(str % keys).chomp('/')
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
@uri
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Request < Module
|
33
|
+
def initialize(uri)
|
34
|
+
@uri = uri
|
35
|
+
end
|
36
|
+
|
37
|
+
def included(base)
|
38
|
+
base.extend ClassMethods
|
39
|
+
path_builder = PathBuilder.new @uri
|
40
|
+
base.define_singleton_method :path do
|
41
|
+
path_builder
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module ClassMethods
|
46
|
+
def get(path, params = {})
|
47
|
+
response = raw_request(:get, path, params)
|
48
|
+
build_response_object response
|
49
|
+
end
|
50
|
+
|
51
|
+
def delete(path, params = {})
|
52
|
+
response = raw_request(:delete, path, params)
|
53
|
+
response.body
|
54
|
+
end
|
55
|
+
|
56
|
+
def post(path, params = {})
|
57
|
+
response = raw_request(:post, path, params)
|
58
|
+
build_response_object response
|
59
|
+
end
|
60
|
+
|
61
|
+
def put(path, params = {})
|
62
|
+
response = raw_request(:put, path, params)
|
63
|
+
build_response_object response
|
64
|
+
end
|
65
|
+
|
66
|
+
def raw_request(method, path, params = {})
|
67
|
+
client = params.delete(:connection) || Veeqo.api
|
68
|
+
client.send(method, path.to_s, params)
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def build_response_object(response)
|
74
|
+
json = parse response.body
|
75
|
+
if json.is_a? Array
|
76
|
+
json.map { |obj| new obj }
|
77
|
+
else
|
78
|
+
new json
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def parse(json)
|
83
|
+
return [] if json.empty?
|
84
|
+
JSON.parse(json, symbolize_names: true)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Veeqo
|
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, params = {})
|
28
|
+
raise ArgumentError if resource_id.nil?
|
29
|
+
get path.build(resource_id), params
|
30
|
+
end
|
31
|
+
|
32
|
+
def create(params = {})
|
33
|
+
post path.build, params
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(resource_id, params = {})
|
37
|
+
raise ArgumentError if resource_id.nil?
|
38
|
+
put path.build(resource_id), params
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy(resource_id, params = {})
|
42
|
+
raise ArgumentError if resource_id.nil?
|
43
|
+
delete path.build(resource_id), params
|
44
|
+
end
|
45
|
+
|
46
|
+
def destroy_all(params = {})
|
47
|
+
delete path.build, params
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Channels
|
2
|
+
# Resources related to the channels in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/channels
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Channel < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'channels/%d', disable: [:destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :type_code
|
11
|
+
property :created_by_id
|
12
|
+
property :name
|
13
|
+
property :currency_code
|
14
|
+
property :state
|
15
|
+
property :url
|
16
|
+
property :shopify_url
|
17
|
+
property :ebay_url
|
18
|
+
property :ebay_site_code_id
|
19
|
+
property :country
|
20
|
+
property :region
|
21
|
+
property :city
|
22
|
+
property :address_line_1
|
23
|
+
property :address_line_2
|
24
|
+
property :post_code
|
25
|
+
property :pulled_products_at
|
26
|
+
property :pulled_orders_at
|
27
|
+
property :pending_setup
|
28
|
+
property :seller_id
|
29
|
+
property :marketplace_id
|
30
|
+
property :mws_auth_token
|
31
|
+
property :deleted_at
|
32
|
+
property :deleted_by_id
|
33
|
+
property :api2cart_store_key
|
34
|
+
property :bridge_url
|
35
|
+
property :bridge_verified
|
36
|
+
property :pull_pending_orders
|
37
|
+
property :default_send_shipment_email
|
38
|
+
property :automatic_product_linking_disabled
|
39
|
+
property :update_remote_order
|
40
|
+
property :successfully_fetched_stock_levels_at
|
41
|
+
property :create_product_if_unmatched
|
42
|
+
property :skip_title_matching
|
43
|
+
property :email
|
44
|
+
property :skip_fba_orders_and_products
|
45
|
+
property :pull_stock_level_required
|
46
|
+
property :pull_historical_orders
|
47
|
+
property :adjust_orders_tax_rate
|
48
|
+
property :send_notification_emails_to_customers
|
49
|
+
property :end_ebay_listing_on_out_of_stock
|
50
|
+
property :update_product_attributes
|
51
|
+
property :max_qty_to_advert
|
52
|
+
property :min_threshold_qty
|
53
|
+
property :percent_of_qty
|
54
|
+
property :always_set_qty
|
55
|
+
property :veeqo_dictates_stock_level
|
56
|
+
property :with_fba
|
57
|
+
property :first_sync_finish_notice_marked_as_read
|
58
|
+
property :pull_unpaid_shopify_orders
|
59
|
+
property :create_product_on_ended_listings
|
60
|
+
property :channel_warehouses
|
61
|
+
property :warehouses
|
62
|
+
property :stock_level_update_requests
|
63
|
+
property :channel_specific
|
64
|
+
property :time_since_product_sync
|
65
|
+
property :time_since_order_sync
|
66
|
+
property :time_since_tried_fetch_stock_level
|
67
|
+
property :time_since_successfully_fetch_stock_level
|
68
|
+
property :default_warehouse
|
69
|
+
property :remote
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Company
|
2
|
+
# Metadata that describes the Company.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/company
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Company < Resource
|
7
|
+
include Veeqo::Request.new 'current_company'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
|
11
|
+
def self.info(params = {})
|
12
|
+
get path.build, params
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.check_connection
|
16
|
+
info
|
17
|
+
true
|
18
|
+
rescue Veeqo::Unauthorized
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# customers
|
2
|
+
# Resources related to the customers in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/customers
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Customer < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'customers/%d', disable: [:destroy, :destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :email
|
11
|
+
property :phone
|
12
|
+
property :mobile
|
13
|
+
property :created_by_id
|
14
|
+
property :billing_address
|
15
|
+
property :shipping_addresses
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# DeliveryMethods
|
2
|
+
# Resources related to the DeliveryMethods in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/delivery_methods
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class DeliveryMethod < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'delivery_methods/%d', disable: [:destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :cost
|
11
|
+
property :name
|
12
|
+
property :user_id
|
13
|
+
property :created_at
|
14
|
+
property :updated_at
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Orders
|
2
|
+
# Resources related to the orders in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/orders
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Order < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'orders/%d', disable: [:destroy, :destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :allocated_completely
|
11
|
+
property :allocations
|
12
|
+
property :buyer_user_id
|
13
|
+
property :cancel_reason
|
14
|
+
property :cancelled_at
|
15
|
+
property :cancelled_by
|
16
|
+
property :channel
|
17
|
+
property :created_at
|
18
|
+
property :created_by
|
19
|
+
property :customer
|
20
|
+
property :customer_note
|
21
|
+
property :customer_viewable_notes
|
22
|
+
property :deliver_to
|
23
|
+
property :delivery_cost
|
24
|
+
property :delivery_method
|
25
|
+
property :due_date
|
26
|
+
property :employee_notes
|
27
|
+
property :fulfilled_by_amazon
|
28
|
+
property :international
|
29
|
+
property :line_items
|
30
|
+
property :notes
|
31
|
+
property :number
|
32
|
+
property :packed_completely
|
33
|
+
property :payment
|
34
|
+
property :picked_completely
|
35
|
+
property :receipt_printed
|
36
|
+
property :refund_amount
|
37
|
+
property :returns
|
38
|
+
property :send_notification_email
|
39
|
+
property :send_refund_email
|
40
|
+
property :shipped_at
|
41
|
+
property :status
|
42
|
+
property :subtotal_price
|
43
|
+
property :tags
|
44
|
+
property :till_id
|
45
|
+
property :total_discounts
|
46
|
+
property :total_price
|
47
|
+
property :total_tax
|
48
|
+
property :updated_at
|
49
|
+
property :updated_by
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Products
|
2
|
+
# Resources related to the products in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/products
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Product < Resource
|
7
|
+
include Veeqo::ResourceActions.new uri: 'products/%d'
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :active_channels
|
11
|
+
property :brand
|
12
|
+
property :channel_products
|
13
|
+
property :created_at
|
14
|
+
property :created_by_id
|
15
|
+
property :deleted_at
|
16
|
+
property :deleted_by_id
|
17
|
+
property :description
|
18
|
+
property :estimated_delivery
|
19
|
+
property :hs_tariff_number
|
20
|
+
property :image
|
21
|
+
property :inventory
|
22
|
+
property :main_image
|
23
|
+
property :main_image_src
|
24
|
+
property :notes
|
25
|
+
property :on_hand_value
|
26
|
+
property :origin_country
|
27
|
+
property :product_tax_rate_id
|
28
|
+
property :sellables
|
29
|
+
property :stock_level_sync_status
|
30
|
+
property :tags
|
31
|
+
property :tax_rate
|
32
|
+
property :title
|
33
|
+
property :total_allocated_stock_level
|
34
|
+
property :total_available_stock_level
|
35
|
+
property :total_quantity_sold
|
36
|
+
property :total_stock_level
|
37
|
+
property :updated_at
|
38
|
+
property :updated_by_id
|
39
|
+
property :web_meta_description
|
40
|
+
property :web_meta_keywords
|
41
|
+
property :web_meta_title
|
42
|
+
property :web_page_title
|
43
|
+
property :web_page_url
|
44
|
+
property :weight
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# PurchaseOrder
|
2
|
+
# Resources related to the purchase order in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/purchase_orders
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class PurchaseOrder < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'purchase_orders/%d', disable: [:create, :update, :destroy, :destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :number
|
11
|
+
property :user_id
|
12
|
+
property :supplier_id
|
13
|
+
property :destination_warehouse_id
|
14
|
+
property :state
|
15
|
+
property :estimated_delivery_days
|
16
|
+
property :actual_delivery_days
|
17
|
+
property :estimated_return_days
|
18
|
+
property :actual_return_days
|
19
|
+
property :started_at
|
20
|
+
property :received_at
|
21
|
+
property :returned_at
|
22
|
+
property :completed_at
|
23
|
+
property :started_or_returned_at_calc
|
24
|
+
property :arrival_at_calc
|
25
|
+
property :total_calc
|
26
|
+
property :created_by_id
|
27
|
+
property :updated_by_id
|
28
|
+
property :created_at
|
29
|
+
property :updated_at
|
30
|
+
property :send_to_supplier
|
31
|
+
property :line_items
|
32
|
+
property :supplier
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# customers
|
2
|
+
# Resources related to the customers in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/customers
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Supplier < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'suppliers/%d', disable: [:find, :destroy, :destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :name
|
11
|
+
property :address_line_1
|
12
|
+
property :address_line_2
|
13
|
+
property :city
|
14
|
+
property :region
|
15
|
+
property :country
|
16
|
+
property :post_code
|
17
|
+
property :sales_contact_name
|
18
|
+
property :sales_contact_email
|
19
|
+
property :accounting_contact_name
|
20
|
+
property :accounting_contact_email
|
21
|
+
property :credit_limit
|
22
|
+
property :currency_code
|
23
|
+
property :created_by_id
|
24
|
+
property :updated_by_id
|
25
|
+
property :deleted_at
|
26
|
+
property :deleted_by_id
|
27
|
+
property :created_at
|
28
|
+
property :updated_at
|
29
|
+
property :sales_phone_number
|
30
|
+
property :accounting_phone_number
|
31
|
+
property :bank_account_number
|
32
|
+
property :bank_sort_code
|
33
|
+
property :bank_name
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Warehouses
|
2
|
+
# Resources related to the Warehouses in the API.
|
3
|
+
# https://developers.veeqo.com/docs/versions/1-0-0-beta/resources/warehouses
|
4
|
+
|
5
|
+
module Veeqo
|
6
|
+
class Warehouse < Resource
|
7
|
+
include Veeqo::ResourceActions.new(uri: 'warehouses/%d', disable: [:create, :update, :destroy, :destroy_all])
|
8
|
+
|
9
|
+
property :id
|
10
|
+
property :address_line_1
|
11
|
+
property :address_line_2
|
12
|
+
property :city
|
13
|
+
property :click_and_collect_days
|
14
|
+
property :click_and_collect_enabled
|
15
|
+
property :country
|
16
|
+
property :created_at
|
17
|
+
property :created_by_id
|
18
|
+
property :default_min_reorder
|
19
|
+
property :deleted_at
|
20
|
+
property :deleted_by_id
|
21
|
+
property :inventory_type_code
|
22
|
+
property :name
|
23
|
+
property :phone
|
24
|
+
property :post_code
|
25
|
+
property :region
|
26
|
+
property :updated_at
|
27
|
+
property :updated_by_id
|
28
|
+
property :requested_carrier_account
|
29
|
+
property :on_hand_value
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Veeqo
|
2
|
+
class SubresourceActions < ResourceActions
|
3
|
+
def included(base)
|
4
|
+
base.send(:include, Request.new(options[:uri]))
|
5
|
+
base.extend(ClassMethods)
|
6
|
+
options[:disable_methods] ||= []
|
7
|
+
methods = ClassMethods.public_instance_methods & options[:disable_methods]
|
8
|
+
methods.each { |name| base.send(:remove_method, name) }
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def all(parent_id, params = {})
|
13
|
+
raise ArgumentError if parent_id.nil?
|
14
|
+
get path.build(parent_id), params
|
15
|
+
end
|
16
|
+
|
17
|
+
def find(parent_id, resource_id, params = {})
|
18
|
+
raise ArgumentError if [parent_id, resource_id].any?(&:nil?)
|
19
|
+
get path.build([parent_id, resource_id]), params
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(parent_id, params = {})
|
23
|
+
raise ArgumentError if parent_id.nil?
|
24
|
+
post path.build(parent_id), params
|
25
|
+
end
|
26
|
+
|
27
|
+
def update(parent_id, resource_id, params = {})
|
28
|
+
raise ArgumentError if [parent_id, resource_id].any?(&:nil?)
|
29
|
+
put path.build([parent_id, resource_id]), params
|
30
|
+
end
|
31
|
+
|
32
|
+
def destroy(parent_id, resource_id, params = {})
|
33
|
+
raise ArgumentError if [parent_id, resource_id].any?(&:nil?)
|
34
|
+
delete path.build([parent_id, resource_id]), params
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy_all(parent_id, params = {})
|
38
|
+
raise ArgumentError if parent_id.nil?
|
39
|
+
delete path.build(parent_id), params
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: veeqo_api_ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yurkiv Misha
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-nc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday_middleware
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: hashie
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.4'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.4'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: jwt
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.5.4
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.5.4
|
125
|
+
description: Ruby client library for the Veeqo API
|
126
|
+
email:
|
127
|
+
- m.yurkiv@coaxsoft.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- README.md
|
133
|
+
- lib/veeqo.rb
|
134
|
+
- lib/veeqo/config.rb
|
135
|
+
- lib/veeqo/connection.rb
|
136
|
+
- lib/veeqo/exception.rb
|
137
|
+
- lib/veeqo/middleware/auth.rb
|
138
|
+
- lib/veeqo/middleware/http_exception.rb
|
139
|
+
- lib/veeqo/request.rb
|
140
|
+
- lib/veeqo/resource_actions.rb
|
141
|
+
- lib/veeqo/resources/channel.rb
|
142
|
+
- lib/veeqo/resources/company.rb
|
143
|
+
- lib/veeqo/resources/customer.rb
|
144
|
+
- lib/veeqo/resources/delivery_method.rb
|
145
|
+
- lib/veeqo/resources/order.rb
|
146
|
+
- lib/veeqo/resources/product.rb
|
147
|
+
- lib/veeqo/resources/purchase_order.rb
|
148
|
+
- lib/veeqo/resources/resource.rb
|
149
|
+
- lib/veeqo/resources/supplier.rb
|
150
|
+
- lib/veeqo/resources/warehouse.rb
|
151
|
+
- lib/veeqo/subresource_actions.rb
|
152
|
+
- lib/veeqo/version.rb
|
153
|
+
homepage: https://github.com/coaxsoft/veeqo_api_ruby
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
metadata: {}
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 2.0.0
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.6.8
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Ruby client library for the Veeqo API
|
177
|
+
test_files: []
|