lucid_shopify 0.9.2 → 0.10.0

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: d302ee03a14fad6032ab30eb06d07d858a085d3d1befa395716f5def19d999db
4
- data.tar.gz: d773c4c5059b0fe0294ad708e5cefe1be1c3c978ca5ad1ca2b40a56467b13ec2
3
+ metadata.gz: 54384b212539ba8bd10ac90e842212ddf17509588d27f8501c8e532af66695d7
4
+ data.tar.gz: e01e73471dfccc65c7875069068533a84ee41e2cf8ef1607aed4471452d5a427
5
5
  SHA512:
6
- metadata.gz: e6f5b158605a962be8cdac9bdde5f57bb0102baa1670b1dbd67aa9bcf4b89b74b47b674de44a2336ca3a8d0591246c98c26fe7cf91ce2a8cc81fe6d931173f4b
7
- data.tar.gz: ee6ccfadededbe26459382419b8f530bfd09cbc0d85c1b18dedc613f0039f276a3c536b18ddac1f65a2dd2729b46c014ae556c8ba99179a5e7d7553e083005b8
6
+ metadata.gz: 3f54f952478dea3eccf83efd35c6a6f62aaf3b88109adfb366a63f8e89960681b099822d8100c790055344e775ecd4e7b7fee8bb5d0fe632d7840a45d65108a3
7
+ data.tar.gz: 30e14e9481392806c135d270d4053c62aa58e6b0b780e223dc469abd7daf52edf9c9983fdbfab9dbae4371c1a1d7e11a80c7fdc1e6f1ef96fe929fb1fb759030
data/README.md CHANGED
@@ -95,9 +95,37 @@ Verify webhook requests with the request data and the HMAC header:
95
95
 
96
96
  ### Authorization
97
97
 
98
- _TODO_
98
+ authorize = LucidShopify::Authorize.new
99
99
 
100
+ access_token = authorize.(request_credentials, authorization_code)
100
101
 
101
- ### Make an API request
102
102
 
103
- _TODO_
103
+ ### Billing
104
+
105
+ Create a new charge:
106
+
107
+ create_charge = LucidShopify::CreateCharge.new
108
+
109
+ charge = create_charge.(request_credentials, charge) # see LucidShopify::Charge
110
+
111
+ Redirect the user to `charge['confirmation_url']`. When the user
112
+ returns (see `config.billing_callback_uri`), activate the accepted
113
+ charge:
114
+
115
+ activate_charge = LucidShopify::ActivateCharge.new
116
+
117
+ activate_charge.(request_credentials, accepted_charge)
118
+
119
+
120
+ ### Make API requests
121
+
122
+ client = LucidShopify::Client.new
123
+
124
+ client.get(request_credentials, 'orders', since_id: since_id)['orders']
125
+ client.post_json(request_credentials, 'orders', new_order)
126
+
127
+
128
+ ### Make throttled API requests
129
+
130
+ client.throttled.get(request_credentials, 'orders')
131
+ client.throttled.post_json(request_credentials, 'orders', new_order)
data/lib/lucid_shopify.rb CHANGED
@@ -4,6 +4,7 @@ require 'dry/initializer'
4
4
 
5
5
  module LucidShopify
6
6
  autoload :ActivateCharge, 'lucid_shopify/activate_charge'
7
+ autoload :Authorize, 'lucid_shopify/authorize'
7
8
  autoload :Charge, 'lucid_shopify/charge'
8
9
  autoload :Client, 'lucid_shopify/client'
9
10
  autoload :Config, 'lucid_shopify/config'
@@ -15,7 +16,6 @@ module LucidShopify
15
16
  autoload :DeleteRequest, 'lucid_shopify/delete_request'
16
17
  autoload :DeleteWebhook, 'lucid_shopify/delete_webhook'
17
18
  autoload :Error, 'lucid_shopify/error'
18
- autoload :FetchAccessToken, 'lucid_shopify/fetch_access_token'
19
19
  autoload :GetRequest, 'lucid_shopify/get_request'
20
20
  autoload :PostRequest, 'lucid_shopify/post_request'
21
21
  autoload :PutRequest, 'lucid_shopify/put_request'
@@ -3,7 +3,7 @@
3
3
  require 'lucid_shopify/container'
4
4
 
5
5
  module LucidShopify
6
- class FetchAccessToken
6
+ class Authorize
7
7
  Error = Class.new(Error)
8
8
 
9
9
  #
@@ -9,13 +9,13 @@ module LucidShopify
9
9
 
10
10
  # Services only (dependencies); no value objects, entities.
11
11
  Container.register(:activate_charge) { ActivateCharge.new }
12
+ Container.register(:authorize) { Authorize.new }
12
13
  Container.register(:client) { Client.new }
13
14
  Container.register(:create_all_webhooks) { CreateAllWebhooks.new }
14
15
  Container.register(:create_charge) { CreateCharge.new }
15
16
  Container.register(:create_webhook) { CreateWebhook.new }
16
17
  Container.register(:delete_all_webhooks) { DeleteAllWebhooks.new }
17
18
  Container.register(:delete_webhook) { DeleteWebhook.new }
18
- Container.register(:fetch_access_token) { FetchAccessToken.new }
19
19
  Container.register(:send_request) { SendRequest.new }
20
20
  Container.register(:send_throttled_request) { SendThrottledRequest.new }
21
21
  Container.register(:verify_callback) { VerifyCallback.new }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucidShopify
4
- VERSION = '0.9.2'
4
+ VERSION = '0.10.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid_shopify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelsey Judson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-13 00:00:00.000000000 Z
11
+ date: 2018-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -117,6 +117,7 @@ files:
117
117
  - README.md
118
118
  - lib/lucid_shopify.rb
119
119
  - lib/lucid_shopify/activate_charge.rb
120
+ - lib/lucid_shopify/authorize.rb
120
121
  - lib/lucid_shopify/charge.rb
121
122
  - lib/lucid_shopify/client.rb
122
123
  - lib/lucid_shopify/config.rb
@@ -128,7 +129,6 @@ files:
128
129
  - lib/lucid_shopify/delete_request.rb
129
130
  - lib/lucid_shopify/delete_webhook.rb
130
131
  - lib/lucid_shopify/error.rb
131
- - lib/lucid_shopify/fetch_access_token.rb
132
132
  - lib/lucid_shopify/get_request.rb
133
133
  - lib/lucid_shopify/post_request.rb
134
134
  - lib/lucid_shopify/put_request.rb