janio_api 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/janio_api/resources/item.rb +6 -5
- data/lib/janio_api/resources/order.rb +3 -2
- data/lib/janio_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 542d4805b31a98533c7ba8d2cb17ff9851f643288a0de16a9abb47c3c17b0e02
|
4
|
+
data.tar.gz: 86f38640d3aea10c2ffb604dfee12e556756ee000304e0e6ac00269106eb114f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 649708263798048d8fd1369ef5f34bb0ccc413571ab7aaee27dcef60e67bcc815dc461ef343a08c7f43bb5a672794729f3e2f5d67f7fbcf55250f4550f35907a
|
7
|
+
data.tar.gz: 90607e4fc9e7cff539daf3465a3eeae3a74e1b058c9e5e21f571f82f08191938583fef985c2e4a8a87c1e3c34f6e197bba21c8c9161df0966a1dae4127c7b787
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module JanioAPI
|
2
2
|
class Item < Base
|
3
|
+
VALID_ITEM_CATEGORIES = ["Fashion Accessories", "Fashion Footwear", "Fashion Apparels (Men)", "Fashion Apparels (Women)",
|
4
|
+
"Fashion Apparels (Babies, Toddlers and Children)", "Fashion Apparel", "Electronics",
|
5
|
+
"Electronics (Non-Telecommunications)", "Electronics (Telecommunications)", "Lifestyle Products",
|
6
|
+
"Lifestyle (Health Related)", "Lifestyle (Beauty Related)", "Lifestyle (Home & Living)",
|
7
|
+
"Lifestyle (Hobbies & Collection)", "Lifestyle (Pantry & Packaged Food & Beverages)", "Others", "Printed Matters"].freeze
|
3
8
|
validates :item_desc, :item_quantity, :item_price_value, :item_price_currency, presence: true
|
4
|
-
validates :item_category, inclusion:
|
5
|
-
"Fashion Apparels (Babies, Toddlers and Children)", "Fashion Apparel", "Electronics",
|
6
|
-
"Electronics (Non-Telecommunications)", "Electronics (Telecommunications)", "Lifestyle Products",
|
7
|
-
"Lifestyle (Health Related)", "Lifestyle (Beauty Related)", "Lifestyle (Home & Living)",
|
8
|
-
"Lifestyle (Hobbies & Collection)", "Lifestyle (Pantry & Packaged Food & Beverages)", "Others", "Printed Matters"]
|
9
|
+
validates :item_category, inclusion: {in: VALID_ITEM_CATEGORIES, message: "%{value} is not a valid item category, valid item categories are #{VALID_ITEM_CATEGORIES.join(", ")}"}
|
9
10
|
|
10
11
|
class << self
|
11
12
|
def find(*args)
|
@@ -19,6 +19,7 @@ module JanioAPI
|
|
19
19
|
"Singapore", "South Korea", "Spain", "Taiwan", "Thailand", "UAE", "UK", "US", "Vietnam"].freeze
|
20
20
|
|
21
21
|
POSTAL_EXCLUDED_COUNTRIES = ["Hong Kong", "Vietnam"].freeze
|
22
|
+
VALID_PAYMENT_TYPES = ["cod", "prepaid"].freeze
|
22
23
|
|
23
24
|
self.prefix = "/api/order/orders/"
|
24
25
|
self.element_name = ""
|
@@ -30,10 +31,10 @@ module JanioAPI
|
|
30
31
|
:consignee_city, :consignee_province, :consignee_email, :pickup_contact_name, :pickup_contact_number, :pickup_country, :pickup_address,
|
31
32
|
:pickup_state, :pickup_city, :pickup_province, :pickup_date, :pickup_notes, presence: true
|
32
33
|
|
33
|
-
validates :pickup_country, :consignee_country, inclusion: SUPPORTED_COUNTRIES
|
34
|
+
validates :pickup_country, :consignee_country, inclusion: {in: SUPPORTED_COUNTRIES, message: "%{value} is not a supported country, supported countries are #{SUPPORTED_COUNTRIES.join(", ")}"}
|
34
35
|
validates :pickup_postal, :consignee_postal, presence: true, unless: -> { POSTAL_EXCLUDED_COUNTRIES.include?(consignee_country) }
|
35
36
|
validates :pickup_postal, presence: true, unless: -> { POSTAL_EXCLUDED_COUNTRIES.include?(pickup_country) }
|
36
|
-
validates :payment_type, inclusion:
|
37
|
+
validates :payment_type, inclusion: {in: VALID_PAYMENT_TYPES, message: "%{value} is not a valid payment type, valid payment types are #{VALID_PAYMENT_TYPES.join(", ")}"}
|
37
38
|
validates :cod_amount_to_collect, presence: true, if: -> { payment_type == "cod" }
|
38
39
|
validates :items, length: {minimum: 1, message: "are required. Please add at least one."}
|
39
40
|
|
data/lib/janio_api/version.rb
CHANGED