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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04a3235356eb0a618c751d56eb55b12f9725bdf40a90707183e8e55b6219d6f0
4
- data.tar.gz: da36fefca3fda541fdbc9337cfaa4129ee4b0093761b2016f5057a5c4044aeac
3
+ metadata.gz: 542d4805b31a98533c7ba8d2cb17ff9851f643288a0de16a9abb47c3c17b0e02
4
+ data.tar.gz: 86f38640d3aea10c2ffb604dfee12e556756ee000304e0e6ac00269106eb114f
5
5
  SHA512:
6
- metadata.gz: fa2ac1e65e0222b6bfe40f93eda22d8f3c2547bed90bac8549b728d458387e512f1daf8ff88b0a9d0b3a3a7493a4921d4e5100a420edb417bc1cdd4533a72cc4
7
- data.tar.gz: 915998a5b2cd70ada6e6c012e6110d3461b6977aad76a5eadabdc38cde14febe34bd31bceeb2ecbbc6ae75a57f5ee60ef35ac933e9dcc1afa061aaf62cac8243
6
+ metadata.gz: 649708263798048d8fd1369ef5f34bb0ccc413571ab7aaee27dcef60e67bcc815dc461ef343a08c7f43bb5a672794729f3e2f5d67f7fbcf55250f4550f35907a
7
+ data.tar.gz: 90607e4fc9e7cff539daf3465a3eeae3a74e1b058c9e5e21f571f82f08191938583fef985c2e4a8a87c1e3c34f6e197bba21c8c9161df0966a1dae4127c7b787
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- janio_api (0.1.4)
4
+ janio_api (0.1.5)
5
5
  activeresource
6
6
 
7
7
  GEM
@@ -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: ["Fashion Accessories", "Fashion Footwear", "Fashion Apparels (Men)", "Fashion Apparels (Women)",
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: ["cod", "prepaid"]
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
 
@@ -1,3 +1,3 @@
1
1
  module JanioAPI
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: janio_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Chong