lemonsqueezy 0.1.0 → 0.1.1

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: 159648c0a2258cb867fc0b4119e816aceccb4584fd45fc690e91b3db2f760865
4
- data.tar.gz: d56a260c987b0039d7a8c6376d8686d1cdb32128b0039f61787644eaa34e9707
3
+ metadata.gz: 6caa3dd3252a4d5e97ccffa65a6cbdc82afb275d58591904ed4ca575e5254cf7
4
+ data.tar.gz: 2e3881b8b63e63525dda7839b714740c70565282a3552e955b2e7c0295a74a17
5
5
  SHA512:
6
- metadata.gz: 3c8b6936badab690f9e73cf97777074ef32724382135de8699258f9ca87ba3cc5a6f8fef0b385f86645436967ba329ab388d8e9128ad5ec7451073f4187283de
7
- data.tar.gz: 829dd9b1560c6d6a7bb534332ccb4af2ae3c0333e06c4bbed0aee8666bc5139480064c4a8358c5703c385a3e2747cf7085e47f529880d91730dfa7518dce63d0
6
+ metadata.gz: e6e61129aa111dea54a26a2ac0915fce6ea1217d3bfaed1afbd0e432297496081f1d046a4fef554515d1cb9e81a35571c792cf4d674ef97bc7aa44960275ab56
7
+ data.tar.gz: b86eaa0cb92691704d289ac7785003937e77b3dec5679a5c986f9fc889f94a267633924bcbbb2406f5fe0b94ea537ec80c1c3fb863ff950a9c654644922aae4a
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lemonsqueezy (0.1.0)
4
+ lemonsqueezy (0.1.1)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  dotenv (2.7.6)
11
- faraday (2.5.2)
11
+ faraday (2.6.0)
12
12
  faraday-net_http (>= 2.0, < 3.1)
13
13
  ruby2_keywords (>= 0.0.4)
14
- faraday-net_http (3.0.0)
14
+ faraday-net_http (3.0.1)
15
15
  minitest (5.15.0)
16
16
  rake (13.0.6)
17
17
  ruby2_keywords (0.0.5)
@@ -16,6 +16,34 @@ module LemonSqueezy
16
16
  StoresResource.new(self)
17
17
  end
18
18
 
19
+ def products
20
+ ProductsResource.new(self)
21
+ end
22
+
23
+ def variants
24
+ VariantsResource.new(self)
25
+ end
26
+
27
+ def orders
28
+ OrdersResource.new(self)
29
+ end
30
+
31
+ def subscriptions
32
+ SubscriptionsResource.new(self)
33
+ end
34
+
35
+ def discounts
36
+ DiscountsResource.new(self)
37
+ end
38
+
39
+ def license_keys
40
+ LicenseKeysResource.new(self)
41
+ end
42
+
43
+ def files
44
+ FilesResource.new(self)
45
+ end
46
+
19
47
  def connection
20
48
  @connection ||= Faraday.new(BASE_URL) do |conn|
21
49
  conn.request :authorization, :Bearer, access_token
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class Discount < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class File < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class LicenseKey < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class Order < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class OrderItem < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class Product < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module LemonSqueezy
2
+ class Subscription < Object
3
+
4
+ def initialize(options = {})
5
+ options.delete "relationships"
6
+ options.delete "links"
7
+
8
+ super options
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module LemonSqueezy
2
+ class DiscountsResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("discounts", params: params)
6
+ Collection.from_response(response, type: Discount)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("discounts/#{id}")
11
+ Discount.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module LemonSqueezy
2
+ class FilesResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("files", params: params)
6
+ Collection.from_response(response, type: File)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("files/#{id}")
11
+ File.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module LemonSqueezy
2
+ class LicenseKeysResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("license-keys", params: params)
6
+ Collection.from_response(response, type: LicenseKey)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("license-keys/#{id}")
11
+ LicenseKey.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ module LemonSqueezy
2
+ class OrdersResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("orders", params: params)
6
+ Collection.from_response(response, type: Order)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("orders/#{id}")
11
+ Order.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ def order_items(id:)
15
+ response = get_request("order-items", params: {order_id: id})
16
+ Collection.from_response(response, type: OrderItem)
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ module LemonSqueezy
2
+ class ProductsResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("products", params: params)
6
+ Collection.from_response(response, type: Product)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("products/#{id}")
11
+ Product.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ end
15
+ end
@@ -3,7 +3,6 @@ module LemonSqueezy
3
3
 
4
4
  def list
5
5
  response = get_request("stores")
6
- # response.body["data"]
7
6
  Collection.from_response(response, type: Store)
8
7
  end
9
8
 
@@ -0,0 +1,15 @@
1
+ module LemonSqueezy
2
+ class SubscriptionsResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("subscriptions", params: params)
6
+ Collection.from_response(response, type: Subscription)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("subscriptions/#{id}")
11
+ Subscription.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module LemonSqueezy
2
+ class VariantsResource < Resource
3
+
4
+ def list(**params)
5
+ response = get_request("variants", params: params)
6
+ Collection.from_response(response, type: Variant)
7
+ end
8
+
9
+ def get(id:)
10
+ response = get_request("variants/#{id}")
11
+ Variant.new(response.body["data"]) if response.success?
12
+ end
13
+
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LemonSqueezy
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/lemon_squeezy.rb CHANGED
@@ -13,7 +13,22 @@ module LemonSqueezy
13
13
  autoload :Object, "lemon_squeezy/object"
14
14
 
15
15
  autoload :StoresResource, "lemon_squeezy/resources/stores"
16
+ autoload :ProductsResource, "lemon_squeezy/resources/products"
17
+ autoload :VariantsResource, "lemon_squeezy/resources/variants"
18
+ autoload :OrdersResource, "lemon_squeezy/resources/orders"
19
+ autoload :SubscriptionsResource, "lemon_squeezy/resources/subscriptions"
20
+ autoload :DiscountsResource, "lemon_squeezy/resources/discounts"
21
+ autoload :LicenseKeysResource, "lemon_squeezy/resources/license_keys"
22
+ autoload :FilesResource, "lemon_squeezy/resources/files"
16
23
 
17
24
  autoload :Store, "lemon_squeezy/objects/store"
25
+ autoload :Product, "lemon_squeezy/objects/product"
26
+ autoload :Variant, "lemon_squeezy/objects/variant"
27
+ autoload :Order, "lemon_squeezy/objects/order"
28
+ autoload :OrderItem, "lemon_squeezy/objects/order_item"
29
+ autoload :Subscription, "lemon_squeezy/objects/subscription"
30
+ autoload :Discount, "lemon_squeezy/objects/discount"
31
+ autoload :LicenseKey, "lemon_squeezy/objects/license_key"
32
+ autoload :File, "lemon_squeezy/objects/file"
18
33
 
19
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lemonsqueezy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-02 00:00:00.000000000 Z
11
+ date: 2022-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -44,9 +44,23 @@ files:
44
44
  - lib/lemon_squeezy/collection.rb
45
45
  - lib/lemon_squeezy/error.rb
46
46
  - lib/lemon_squeezy/object.rb
47
+ - lib/lemon_squeezy/objects/discount.rb
48
+ - lib/lemon_squeezy/objects/file.rb
49
+ - lib/lemon_squeezy/objects/license_key.rb
50
+ - lib/lemon_squeezy/objects/order.rb
51
+ - lib/lemon_squeezy/objects/order_item.rb
52
+ - lib/lemon_squeezy/objects/product.rb
47
53
  - lib/lemon_squeezy/objects/store.rb
54
+ - lib/lemon_squeezy/objects/subscription.rb
48
55
  - lib/lemon_squeezy/resource.rb
56
+ - lib/lemon_squeezy/resources/discounts.rb
57
+ - lib/lemon_squeezy/resources/files.rb
58
+ - lib/lemon_squeezy/resources/license_keys.rb
59
+ - lib/lemon_squeezy/resources/orders.rb
60
+ - lib/lemon_squeezy/resources/products.rb
49
61
  - lib/lemon_squeezy/resources/stores.rb
62
+ - lib/lemon_squeezy/resources/subscriptions.rb
63
+ - lib/lemon_squeezy/resources/variants.rb
50
64
  - lib/lemon_squeezy/version.rb
51
65
  - lib/lemonsqueezy.rb
52
66
  homepage: https://github.com/deanpcmad/lemonsqueezy