falsify 0.1.0

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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rubocop.yml +123 -0
  4. data/.travis.yml +7 -0
  5. data/.yardopts +2 -0
  6. data/CHANGELOG.md +31 -0
  7. data/Gemfile +4 -0
  8. data/Gemfile.lock +75 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +44 -0
  11. data/Rakefile +10 -0
  12. data/bin/console +10 -0
  13. data/bin/docs +3 -0
  14. data/bin/setup +8 -0
  15. data/falsify.gemspec +39 -0
  16. data/lib/falsify.rb +4 -0
  17. data/lib/falsify/error.rb +5 -0
  18. data/lib/falsify/models/address.rb +54 -0
  19. data/lib/falsify/models/customer/customer.rb +114 -0
  20. data/lib/falsify/models/customer/metafield.rb +36 -0
  21. data/lib/falsify/models/fulfillment/fulfillment.rb +96 -0
  22. data/lib/falsify/models/fulfillment/fulfillment_event.rb +75 -0
  23. data/lib/falsify/models/fulfillment/fulfillment_line_item.rb +75 -0
  24. data/lib/falsify/models/fulfillment/supported_tracking_companies.rb +51 -0
  25. data/lib/falsify/models/order/client_details.rb +36 -0
  26. data/lib/falsify/models/order/discount_allocation.rb +15 -0
  27. data/lib/falsify/models/order/discount_application.rb +62 -0
  28. data/lib/falsify/models/order/discount_code.rb +26 -0
  29. data/lib/falsify/models/order/order.rb +248 -0
  30. data/lib/falsify/models/order/order_line_item.rb +102 -0
  31. data/lib/falsify/models/order/price_set.rb +52 -0
  32. data/lib/falsify/models/order/refund/refund.rb +72 -0
  33. data/lib/falsify/models/order/refund/refund_line_item.rb +0 -0
  34. data/lib/falsify/models/order/shipping_line.rb +39 -0
  35. data/lib/falsify/models/order/tax_line.rb +14 -0
  36. data/lib/falsify/models/product/collection/collect.rb +29 -0
  37. data/lib/falsify/models/product/collection/custom_collection.rb +72 -0
  38. data/lib/falsify/models/product/collection/smart_collection.rb +181 -0
  39. data/lib/falsify/models/product/product.rb +83 -0
  40. data/lib/falsify/models/product/product_image.rb +39 -0
  41. data/lib/falsify/models/product/product_variant.rb +111 -0
  42. data/lib/falsify/version.rb +3 -0
  43. metadata +214 -0
@@ -0,0 +1,114 @@
1
+ require "enumerize"
2
+
3
+ module Falsify
4
+ # See the [API documentation](https://help.shopify.com/en/api/reference/customers/customer).
5
+ class Customer
6
+ extend Enumerize
7
+ # Whether the customer has consented to receive marketing material via email.
8
+ # @return [Boolean]
9
+ attr_accessor :accepts_marketing
10
+ # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the customer consented or objected to receiving marketing material by email.
11
+ # Set this value whenever the customer consents or objects to marketing materials.
12
+ # @return [String]
13
+ attr_accessor :accepts_marketing_updated_at
14
+ # A list of the ten most recently updated addresses for the customer.
15
+ # @return [Array<Address>]
16
+ attr_accessor :addresses
17
+ # The three-letter code ([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format) for the currency that the customer used when they paid for their last order.
18
+ # Defaults to the shop currency.
19
+ # Returns the shop currency for test orders.
20
+ # @return [String]
21
+ attr_reader :currency
22
+ # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the customer was created.
23
+ # @return [String]
24
+ attr_reader :created_at
25
+ # The default address for the customer.
26
+ # The default address has the following properties:
27
+ # @return [Address]
28
+ attr_reader :default_address
29
+ # The unique email address of the customer.
30
+ # Attempting to assign the same email address to multiple customers returns an error.
31
+ # @return [String]
32
+ attr_accessor :email
33
+ # The customer's first name.
34
+ # @return [String]
35
+ attr_accessor :first_name
36
+ # A unique identifier for the customer.
37
+ # @return [String]
38
+ attr_accessor :id
39
+ # The customer's last name.
40
+ # @return [String]
41
+ attr_accessor :last_name
42
+ # The ID of the customer's last order.
43
+ # @return [String]
44
+ attr_reader :last_order_id
45
+ # The name of the customer's last order.
46
+ # This is directly related to the `name` field on the Order resource.
47
+ # @return [String]
48
+ attr_reader :last_order_name
49
+ # Attaches additional metadata to a shop's resources.
50
+ # @return [Metafield]
51
+ attr_accessor :metafield
52
+ # @!attribute marketing_opt_in_level [r]
53
+ # The marketing subscription opt-in level (as described by [the M<sup>3</sup>AAWG best practices guideline](https://www.m3aawg.org/sites/maawg/files/news/M3AAWG_Senders_BCP_Ver3-2015-02.pdf)) that the customer gave when they consented to receive marketing material by email.
54
+ # If the customer does not accept email marketing, then this property will be set to `null`.
55
+ # Valid values:
56
+ # - `single_opt_in`
57
+ # - `confirmed_opt_in`
58
+ # - `unknown`
59
+ # @return [:single_opt_in, :confirmed_opt_in, :unknown, nil]
60
+ enumerize :marketing_opt_in_level, in: [:single_opt_in, :confirmed_opt_in, :unknown]
61
+ # A unique identifier for the customer that's used with [Multipass login](https://help.shopify.com/en/api/reference/plus/multipass).
62
+ # @return [String]
63
+ attr_accessor :multipass_identifier
64
+ # A note about the customer.
65
+ # @return [String]
66
+ attr_accessor :note
67
+ # The number of orders associated with this customer.
68
+ # @return [String]
69
+ attr_reader :orders_count
70
+ # The unique phone number ([E.164 format](https://en.wikipedia.org/wiki/E.164)) for this customer.
71
+ # Attempting to assign the same phone number to multiple customers returns an error.
72
+ # The property can be set using different formats, but each format must represent a number that can be dialed from anywhere in the world.
73
+ # The following formats are all valid:
74
+ # - 6135551212
75
+ # - +16135551212
76
+ # - (613)555-1212
77
+ # - +1 613-555-1212
78
+ # @return [String]
79
+ attr_accessor :phone
80
+ # @!attribute state [r]
81
+ # The state of the customer's account with a shop.
82
+ # Default value: `disabled`.
83
+ # Valid values:
84
+ # - `disabled` - The customer doesn't have an active account. Customer accounts can be disabled from the Shopify admin at any time.
85
+ # - `invited` - The customer has received an email invite to create an account.
86
+ # - `enabled` - The customer has created an account.
87
+ # - `declined` - The customer declined the email invite to create an account.
88
+ # @return [String]
89
+ enumerize :state, in: [:disabled, :invited, :enabled, :declined], default: :disabled
90
+ # Tags that the shop owner has attached to the customer, formatted as a string of comma-separated values.
91
+ # A customer can have up to 250 tags.
92
+ # Each tag can have up to 255 characters.
93
+ # @return [String]
94
+ attr_accessor :tags
95
+ # Whether the customer is exempt from paying taxes on their order.
96
+ # If `true`, then taxes won't be applied to an order at checkout.
97
+ # If `false`, then taxes will be applied at checkout.
98
+ # @return [Boolean]
99
+ attr_accessor :tax_exempt
100
+ # Whether the customer is exempt from paying specific taxes on their order.
101
+ # Canadian taxes only.
102
+ # @return [String]
103
+ attr_accessor :tax_exemptions
104
+ # The total amount of money that the customer has spent across their order history.
105
+ # @return [String]
106
+ attr_reader :total_spent
107
+ # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the customer information was last updated.
108
+ # @return [String]
109
+ attr_reader :updated_at
110
+ # Whether the customer has verified their email address.
111
+ # @return [Boolean]
112
+ attr_reader :verified_email
113
+ end
114
+ end
@@ -0,0 +1,36 @@
1
+ module Falsify
2
+ # Attaches additional metadata to a shop's resources
3
+ class Metafield
4
+ # An identifier for the metafield (maximum of 30 characters, required)
5
+ # @return [Boolean]
6
+ attr_accessor :key
7
+ # A container for a set of metadata (maximum of 20 characters, required)
8
+ # Namespaces help distinguish between metadata that you created and metadata created by another individual with a similar namespace.
9
+ # @return [String]
10
+ attr_accessor :namespace
11
+ # Information to be stored as metadata (required)
12
+ # @return [String,Integer]
13
+ attr_accessor :value
14
+ # The value type (required)
15
+ # Valid values: `string` and `integer`.
16
+ # @return [String]
17
+ attr_accessor :value_type
18
+ # Additional information about the metafield (optional)
19
+ # @return [String,nil]
20
+ attr_accessor :description
21
+
22
+ # @param key [String]
23
+ # @param namespace [String]
24
+ # @param value [String,Integer]
25
+ # @param value_type [String]
26
+ # @param description [String]
27
+ # @return [void]
28
+ def initialize(key:, namespace:, value:, value_type:, description: nil)
29
+ self.key = key
30
+ self.namespace = namespace
31
+ self.value = value
32
+ self.value_type = value_type
33
+ self.description = description
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,96 @@
1
+ require "enumerize"
2
+
3
+ module Falsify
4
+ # In Shopify, a fulfillment represents a shipment of one or more items in an order.
5
+ # You can use the Fulfillment resource to view, create, modify, or delete an order's fulfillments.
6
+ # See the [API documentation](https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillment).
7
+ class Fulfillment
8
+ extend Enumerize
9
+ # The date and time when the fulfillment was created.
10
+ # The API returns this value in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).
11
+ # @return [String]
12
+ attr_accessor :created_at
13
+ # The ID for the fulfillment.
14
+ # @return [String]
15
+ attr_accessor :id
16
+ # A historical record of each item in the fulfillment.
17
+ # @return [Array<LineItem>]
18
+ attr_accessor :line_items
19
+ # The unique identifier of the location that the fulfillment should be processed for.
20
+ # To find the ID of the location, use the [Location resource](https://help.shopify.com/en/api/reference/inventory/location).
21
+ # @return [String]
22
+ attr_accessor :location_id
23
+ # The uniquely identifying fulfillment name, consisting of two parts separated by a `.`.
24
+ # The first part represents the order name and the second part represents the fulfillment number.
25
+ # The fulfillment number automatically increments depending on how many fulfillments are in an order (e.g. `#1001.1`, `#1001.2`).
26
+ # @return [String]
27
+ attr_accessor :name
28
+ # Whether the customer should be notified.
29
+ # If set to `true`, then an email will be sent when the fulfillment is created or updated.
30
+ # For orders that were initially created using the API, the default value is `false`.
31
+ # For all other orders, the default value is `true`.
32
+ # @return [Boolean]
33
+ attr_accessor :notify_customer
34
+ # The unique numeric identifier for the order.
35
+ # @return [String]
36
+ attr_accessor :order_id
37
+ # A text field that provides information about the receipt:
38
+ # - **testcase** : Whether the fulfillment was a testcase.
39
+ # - **authorization** : The authorization code.
40
+ # @return [String]
41
+ attr_accessor :receipt
42
+ # The type of service used.
43
+ # @return [Hash]
44
+ attr_accessor :service
45
+ # @!attribute shipment_status [rw]
46
+ # The current shipment status of the fulfillment.
47
+ # Valid values:
48
+ # - `label_printed` - A label for the shipment was purchased and printed.
49
+ # - `label_purchased` - A label for the shipment was purchased, but not printed.
50
+ # - `attempted_delivery` - Delivery of the shipment was attempted, but unable to be completed.
51
+ # - `ready_for_pickup` - The shipment is ready for pickup at a shipping depot.
52
+ # - `confirmed` - The carrier is aware of the shipment, but hasn't received it yet.
53
+ # - `in_transit` - The shipment is being transported between shipping facilities on the way to its destination.
54
+ # - `out_for_delivery` - The shipment is being delivered to its final destination.
55
+ # - `delivered` - The shipment was succesfully delivered.
56
+ # - `failure` - Something went wrong when pulling tracking information for the shipment, such as the tracking number was invalid or the shipment was canceled.
57
+ # @return [:label_printed, :label_purchased, :attempted_delivery, :ready_for_pickup, :confirmed, :in_transit, :out_for_delivery, :delivered, :failure]
58
+ enumerize :shipment_status, in: [:label_printed, :label_purchased, :attempted_delivery, :ready_for_pickup, :confirmed, :in_transit, :out_for_delivery, :delivered, :failure]
59
+ # @!attribute status [rw]
60
+ # The status of the fulfillment.
61
+ # Valid values:
62
+ # - `pending` - The fulfillment is pending.
63
+ # - `open` - The fulfillment has been acknowledged by the service and is in processing.
64
+ # - `success` - The fulfillment was successful.
65
+ # - `cancelled` - The fulfillment was cancelled.
66
+ # - `error` - There was an error with the fulfillment request.
67
+ # - `failure` - The fulfillment request failed.
68
+ # @return [:pending, :open, :success, :cancelled, :error, :failure]
69
+ enumerize :status, in: [:pending, :open, :success, :cancelled, :error, :failure]
70
+ # The name of the tracking company.
71
+ # When creating a fulfillment for a supported carrier, send the `tracking_company` exactly as written in the list above.
72
+ # If the tracking company doesn't match one of the supported entries, then the shipping status might not be updated properly during the fulfillment process.
73
+ # @return [String]
74
+ attr_accessor :tracking_company
75
+ # A list of tracking numbers, provided by the shipping company.
76
+ #
77
+ # It is highly recommended that you send the tracking company and the tracking URL as well.
78
+ # If neither one of these is sent, then the tracking company will be determined automatically.
79
+ # This can result in an invalid tracking URL.
80
+ #
81
+ # The tracking URL is displayed in the shipping confirmation email, which can optionally be sent to the customer.
82
+ # When accounts are enabled, it is also displayed in the customer's order history.
83
+ #
84
+ # @return [Array<String>]
85
+ attr_accessor :tracking_numbers
86
+ # The URLs of tracking pages for the fulfillment.
87
+ # @return [Array<String>]
88
+ attr_accessor :tracking_urls
89
+ # The date and time ([ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601)) when the fulfillment was last modified..
90
+ # @return [String]
91
+ attr_accessor :updated_at
92
+ # The name of the inventory management service.
93
+ # @return [String]
94
+ attr_accessor :variant_inventory_management
95
+ end
96
+ end
@@ -0,0 +1,75 @@
1
+ require "enumerize"
2
+
3
+ module Falsify
4
+ # The FulfillmentEvent resource represents tracking events that belong to a {Fulfillment} of one or more items in an {Order}.
5
+ # Fulfillment events are displayed on the [order status page](https://help.shopify.com/en/manual/orders/status-tracking/customize-status-tracking) to update customers on the status of their shipment.
6
+ # See the [API documentation](https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillmentevent).
7
+ class FulfillmentEvent
8
+ extend Enumerize
9
+ # The street address where the fulfillment event occurred.
10
+ # @return [String]
11
+ attr_accessor :address1
12
+ # The city where the fulfillment event occurred.
13
+ # @return [String]
14
+ attr_accessor :city
15
+ # The country where the fulfillment event occurred.
16
+ # @return [String]
17
+ attr_accessor :country
18
+ # The date and time ([ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) format) when the fulfillment event was created.
19
+ # @return [String]
20
+ attr_accessor :created_at
21
+ # The estimated delivery date based on the fulfillment's tracking number, as long as it's provided by one of the following carriers: USPS, FedEx, UPS, or Canada Post (Canada only).
22
+ # Value is `null` if no tracking number is available or if the tracking number is from an unsupported carrier.
23
+ # This property is available only when [carrier calculated rates](/manual/shipping/rates-and-methods/custom-calculated-rates) are in use.'
24
+ # @return [String,nil]
25
+ attr_accessor :estimated_delivery_at
26
+ # An ID for the fulfillment that's associated with the fulfillment event.
27
+ # @return [String]
28
+ attr_accessor :fulfillment_id
29
+ # The date and time ([ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) format) when the fulfillment event occurred.
30
+ # @return [String]
31
+ attr_accessor :happened_at
32
+ # An ID for the fulfillment event.
33
+ # @return [String]
34
+ attr_accessor :id
35
+ # A geographic coordinate specifying the latitude of the fulfillment event.
36
+ # @return [String]
37
+ attr_accessor :latitude
38
+ # A geographic coordinate specifying the longitude of the fulfillment event.
39
+ # @return [String]
40
+ attr_accessor :longitude
41
+ # An arbitrary message describing the status.
42
+ # Can be provided by a shipping carrier.
43
+ # @return [String]
44
+ attr_accessor :message
45
+ # The ID of the order that's associated with the fulfillment event.
46
+ # @return [String]
47
+ attr_accessor :order_id
48
+ # The province where the fulfillment event occurred.
49
+ # @return [String]
50
+ attr_accessor :province
51
+ # An ID for the shop that's associated with the fulfillment event.
52
+ # @return [String]
53
+ attr_accessor :shop_id
54
+ # @!attribute status [rw]
55
+ # The status of the fulfillment event.
56
+ # Valid values:
57
+ # - `label_printed` - A label for the shipment was purchased and printed.
58
+ # - `label_purchased` - A label for the shipment was purchased, but not printed.
59
+ # - `attempted_delivery` - Delivery of the shipment was attempted, but unable to be completed.
60
+ # - `ready_for_pickup` - The shipment is ready for pickup at a shipping depot.
61
+ # - `confirmed` - The carrier is aware of the shipment, but hasn't received it yet.
62
+ # - `in_transit` - The shipment is being transported between shipping facilities on the way to its destination.
63
+ # - `out_for_delivery` - The shipment is being delivered to its final destination.
64
+ # - `delivered` - The shipment was succesfully delivered.
65
+ # - `failure` - Something went wrong when pulling tracking information for the shipment, such as the tracking number was invalid or the shipment was canceled.
66
+ # @return [:label_printed, :label_purchased, :attempted_delivery, :ready_for_pickup, :confirmed, :in_transit, :out_for_delivery, :delivered, :failure]
67
+ enumerize :status, in: [:label_printed, :label_purchased, :attempted_delivery, :ready_for_pickup, :confirmed, :in_transit, :out_for_delivery, :delivered, :failure]
68
+ # The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the fulfillment event was updated.
69
+ # @return [String]
70
+ attr_accessor :updated_at
71
+ # The zip code of the location where the fulfillment event occurred.
72
+ # @return [String]
73
+ attr_accessor :zip
74
+ end
75
+ end
@@ -0,0 +1,75 @@
1
+ require "enumerize"
2
+
3
+ module Falsify
4
+ # A historical record of an individual item in a fulfillment.
5
+ class FulfillmentLineItem
6
+ extend Enumerize
7
+ # The ID of the line item within the fulfillment.
8
+ # @return [String]
9
+ attr_accessor :id
10
+ # The ID of the product variant being fulfilled.
11
+ # @return [String]
12
+ attr_accessor :variant_id
13
+ # The title of the product.
14
+ # @return [String]
15
+ attr_accessor :title
16
+ # The number of items in the fulfillment.
17
+ # @return [Integer]
18
+ attr_accessor :quantity
19
+ # The price of the item.
20
+ # @return [String]
21
+ attr_accessor :price
22
+ # The weight of the item in grams.
23
+ # @return [String]
24
+ attr_accessor :grams
25
+ # The unique identifier of the item in the fulfillment.
26
+ # @return [String]
27
+ attr_accessor :sku
28
+ # The title of the product variant being fulfilled.
29
+ # @return [String]
30
+ attr_accessor :variant_title
31
+ # The name of the supplier of the item.
32
+ # @return [String]
33
+ attr_accessor :vendor
34
+ # The service provider who is doing the fulfillment.
35
+ # @return [String]
36
+ attr_accessor :fulfillment_service
37
+ # The unique numeric identifier for the product in the fulfillment.
38
+ # @return [String]
39
+ attr_accessor :product_id
40
+ # Whether a customer needs to provide a shipping address when placing an order for this product variant.
41
+ # @return [Boolean]
42
+ attr_accessor :requires_shipping
43
+ # Whether the line item is taxable.
44
+ # @return [Boolean]
45
+ attr_accessor :taxable
46
+ # Whether the line item is a [gift card](https://help.shopify.com/manual/products/gift-card-products).
47
+ # @return [Boolean]
48
+ attr_accessor :gift_card
49
+ # The name of the product variant.
50
+ # @return [String]
51
+ attr_accessor :name
52
+ # The name of the inventory management system.
53
+ # @return [String]
54
+ attr_accessor :variant_inventory_management
55
+ # Any additional properties associated with the line item.
56
+ # @return [Array<String>]
57
+ attr_accessor :properties
58
+ # Whether the product exists.
59
+ # @return [String]
60
+ attr_accessor :product_exists
61
+ # The amount available to fulfill. This is the `quantity - max (refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity - open_fulfilled_quantity`.
62
+ # @return [String]
63
+ attr_accessor :fulfillable_quantity
64
+ # The total of any discounts applied to the line item.
65
+ # @return [String]
66
+ attr_accessor :total_discount
67
+ # @!attribute fulfillment_status [rw]
68
+ # The status of an order in terms of the line items being fulfilled. Valid values: `fulfilled`, `null`, or `partial`.
69
+ # @return [:fulfilled, :null, :partial]
70
+ enumerize :fulfillment_status, in: [:fulfilled, :null, :partial]
71
+ # The `title`, `price`, and `rate` of any taxes applied to the line item.
72
+ # @return [Array<TaxLine>]
73
+ attr_accessor :tax_lines
74
+ end
75
+ end
@@ -0,0 +1,51 @@
1
+ module Falsify
2
+ # Valid values for the `tracking_company` field of a {Fulfillment}.
3
+ # @return [Array<String>]
4
+ def self.supported_tracking_companies
5
+ return [
6
+ "4PX",
7
+ "APC",
8
+ "Amazon Logistics UK",
9
+ "Amazon Logistics US",
10
+ "Australia Post",
11
+ "Bluedart",
12
+ "Canada Post",
13
+ "China Post",
14
+ "Chukou1",
15
+ "Correios",
16
+ "DHL Express",
17
+ "DHL eCommerce",
18
+ "DHL eCommerce Asia",
19
+ "DPD",
20
+ "DPD Local",
21
+ "DPD UK",
22
+ "Delhivery",
23
+ "Eagle",
24
+ "FSC",
25
+ "FedEx",
26
+ "FedEx UK",
27
+ "GLS",
28
+ "Globegistics",
29
+ "Japan Post (EN)",
30
+ "Japan Post (JA)",
31
+ "La Poste",
32
+ "New Zealand Post",
33
+ "Newgistics",
34
+ "PostNL",
35
+ "PostNord",
36
+ "Purolator",
37
+ "Royal Mail",
38
+ "SF Express",
39
+ "Sagawa (EN)",
40
+ "Sagawa (JA)",
41
+ "Singapore Post",
42
+ "TNT",
43
+ "UPS",
44
+ "USPS",
45
+ "Whistl",
46
+ "Yamato (EN)",
47
+ "Yamato (JA)",
48
+ "YunExpress",
49
+ ]
50
+ end
51
+ end