squarespace_api 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec9a53ddcf9c57427b52c4eb4f044fca901ec741be24d2bd7e031de3af2f66ec
4
- data.tar.gz: db58f1b492dd50bd85902940708b7db51114046d81775ff0bc10c5f3181b3464
3
+ metadata.gz: 32478872cc1df7eec10067615d90da41fde3f1c24a53b983822ab88aaca9028a
4
+ data.tar.gz: c78a46681870051cc0c7295ba6f2228ebbf6f282948b7535aa5293136c86fe6b
5
5
  SHA512:
6
- metadata.gz: 3c2e561ca3bdffd2df058d31250ce5f4cd592e35dc2b7b89651aa95f3a6092411fed3c3c470cbf16a6c7854ae3a073bb15ca40392a235a991d70b1bd1f9744f3
7
- data.tar.gz: 160c6527b3636a7abd207ccec9b28213ab644103369bb86094cfe7b6c15c3c316c743eac2b1972d2d0ae39a64b378f4da0862ce7dc8944655e520438ae43aacf
6
+ metadata.gz: 1869f4331c33bec1534947d105beeec2eca1188fc647b8577423c01bc7711d80736e43084a9bbd8426f7abeb87e2cb450a28ee19731e539ad160ab547801322e
7
+ data.tar.gz: 85f777a4903afe12e310d248519db56136d843813e516967bb77675ecee32df6857cb2ba90f55e7113f33da2061175da596a3fd1401bc7900692b3a6e291d11f
data/Gemfile.lock CHANGED
@@ -1,11 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- squarespace_api (0.0.5)
4
+ squarespace_api (0.0.6)
5
5
  faraday
6
6
  faraday_middleware
7
7
  json
8
- yaml
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
@@ -64,7 +63,6 @@ GEM
64
63
  addressable (>= 2.8.0)
65
64
  crack (>= 0.3.2)
66
65
  hashdiff (>= 0.4.0, < 2.0.0)
67
- yaml (0.1.1)
68
66
 
69
67
  PLATFORMS
70
68
  ruby
data/README.md CHANGED
@@ -1,3 +1,211 @@
1
1
  # Squarespace Api
2
2
 
3
- Ruby interface to the Squarespace API
3
+ [![Gem Version](https://badge.fury.io/rb/squarespace_api.svg)](https://rubygems.org/gems/squarespace_api)
4
+
5
+
6
+ Ruby interface to the [Squarespace API](https://developers.squarespace.com/commerce-apis/overview).
7
+
8
+ ## Installation
9
+
10
+ Available in RubyGems.
11
+
12
+ ```bash
13
+ $ gem install 'squarespace_api'
14
+ ```
15
+
16
+ Add to your Gem file
17
+ ```ruby
18
+ gem 'squarespace_api'
19
+ ```
20
+
21
+
22
+
23
+ ## Simple Example Usage
24
+
25
+ - Thread Safety Usage
26
+
27
+ ```ruby
28
+ require 'squarespace_api'
29
+
30
+ client = SquarespaceApi::Client.new(
31
+ SquarespaceApi::Config.new(
32
+ access_token: 'your access token'
33
+ )
34
+ )
35
+
36
+ # get one page of order
37
+ client.orders.all
38
+ => [<SquarespaceOrderHash>, ...]
39
+
40
+
41
+ # get every page of orders with filter
42
+ orders = []
43
+ orders = client.orders.all(fulfillmentStatus: 'PENDING') do |orders_per_page|
44
+ orders += orders_per_page
45
+ # or do something
46
+ end
47
+
48
+ # get website
49
+ client.website
50
+ ```
51
+
52
+
53
+ ## ResourceGroups
54
+
55
+ - [Orders](https://developers.squarespace.com/commerce-apis/orders-overview)
56
+
57
+ ```ruby
58
+ # get one page
59
+ client.orders.all(fulfillmentStatus: 'PENDING')
60
+
61
+ # get all pages
62
+ orders = []
63
+ orders = client.orders.all(fulfillmentStatus: 'PENDING') do |orders_per_page|
64
+ orders += orders_per_page
65
+ # or do something
66
+ end
67
+
68
+ # find an order
69
+ client.orders.find(id)
70
+
71
+ # create an order
72
+ client.orders.create(params)
73
+
74
+ # fulfill an order
75
+ client.orders.fulfil(id, params)
76
+ ```
77
+
78
+ - [Products](https://developers.squarespace.com/commerce-apis/products-overview)
79
+
80
+ ```ruby
81
+ client.products.all
82
+ client.products.create(params)
83
+ client.products.where(id: id)
84
+ client.products.find(id)
85
+ client.products.find_by_ids([id_1, id_2])
86
+ client.products.update(id, params)
87
+ client.products.delete(id)
88
+ ```
89
+
90
+ - ProductImages
91
+
92
+ ```ruby
93
+ # Noted that Path parameters should be passed in body params.
94
+ client.product_images.upload(file_path, { product_id: product_id })
95
+ client.product_images.status(id, { product_id: product_id })
96
+ client.product_images.order(id, { product_id: product_id, afterImageId: 'otherImageId' })
97
+ client.product_images.update(id, { product_id: product_id, altText: 'my_picture' })
98
+ ```
99
+
100
+ - ProductVariants
101
+
102
+ ```ruby
103
+ # Noted that Path parameters should be passed in body params.
104
+ client.product_variants.create({ product_id: product_id })
105
+ client.product_variants.update(id, { sku: 'P1234', product_id: product_id })
106
+ ```
107
+
108
+
109
+ - ProductVarantImages
110
+
111
+ ```ruby
112
+ # Noted that Path parameters should be passed in body params.
113
+ client.product_variant_images.create({ imageId: image_id, product_id: product_id, variant_id: variant_id })
114
+ ```
115
+
116
+ - Inventory
117
+
118
+ ```ruby
119
+ client.inventory.all
120
+ client.inventory.find(id)
121
+ client.inventory_adjustments.create(params)
122
+ ```
123
+
124
+ - Profiles
125
+ ```ruby
126
+ client.profiles.all
127
+ client.profiles.find(id)
128
+ client.profiles.create(params)
129
+ ```
130
+
131
+ - StorePages
132
+ ```ruby
133
+ client.store_pages.all
134
+ ```
135
+
136
+ - Transactions
137
+
138
+ ```ruby
139
+ client.transactions.all
140
+ client.transactions.find(id)
141
+ client.transactions.find_by_ids([id_1, id_2])
142
+ ```
143
+
144
+ - WebhookSubscriptions
145
+
146
+ ```ruby
147
+ client.webhook_subscriptions.all
148
+ client.webhook_subscriptions.find(id)
149
+ client.webhook_subscriptions.create(id)
150
+ client.webhook_subscriptions.update(id, params)
151
+ client.webhook_subscriptions.delete(id)
152
+ client.webhook_subscriptions.send_test_notification(id, params)
153
+ client.webhook_subscriptions.rotate_secret(id)
154
+ ```
155
+
156
+ ## Resource
157
+
158
+ - Website
159
+
160
+ ```ruby
161
+ client.website
162
+ ```
163
+
164
+ ## Oauth App
165
+
166
+ - ENV
167
+
168
+ ```ruby
169
+ # Auto load ENV
170
+ SQUARESPACE_CLIENT_ID = 'your client id'
171
+ SQUARESPACE_CLIENT_SECRET = 'your client secret'
172
+ ```
173
+
174
+ - Construct Oauth Url
175
+
176
+ ```ruby
177
+ client.build_oauth_authorize_url(
178
+ redirect_url: 'https://api.test.com/squarespace',
179
+ scope: 'website.orders,website.orders.read',
180
+ state: '1234',
181
+ access_type: "offline"
182
+ )
183
+ => 'https://login.squarespace.com/api/1/login/oauth/provider/authorize?client_id=&redirect_url=https://api.test.com/squarespace&scope=website.orders,website.orders.read&state=1234&access_type=offline'
184
+ ```
185
+
186
+ - Request Access Token
187
+
188
+ ```ruby
189
+ client = SquarespaceApi::Client.new(
190
+ SquarespaceApi::Config.new(
191
+ # your can specifize application credentials if you have multiple apps
192
+ # otherwise it'll auto load env
193
+ client_id: 'your client id',
194
+ client_secret: 'your client secret'
195
+ )
196
+ )
197
+
198
+ # request access token
199
+ client.tokens.create(
200
+ code: 'code sent from Squaerspace',
201
+ redirect_uri: "your redirect uri"
202
+ )
203
+ ```
204
+
205
+ - Request Refresh Token
206
+ ```ruby
207
+ client.tokens.create(
208
+ refresh_token: 'some_refresh_token',
209
+ grant_type: "refresh_token"
210
+ )
211
+ ```
@@ -1,3 +1,3 @@
1
1
  module SquarespaceApi
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.0.6'.freeze
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe SquarespaceApi do
4
4
  it 'has a version number' do
5
- expect(SquarespaceApi::VERSION).to eq('0.0.5')
5
+ expect(SquarespaceApi::VERSION).to eq('0.0.6')
6
6
  end
7
7
 
8
8
  context 'configure' do
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "squarespace_api"
3
- spec.version = "0.0.5"
3
+ spec.version = "0.0.6"
4
4
  spec.summary = "Ruby gem interacting with the Squarespace API."
5
5
  spec.description = "Ruby gem interacting with the Squarespace API."
6
6
  spec.authors = ["cdragon"]
@@ -18,5 +18,4 @@ Gem::Specification.new do |spec|
18
18
  spec.add_dependency "faraday"
19
19
  spec.add_dependency "faraday_middleware"
20
20
  spec.add_dependency "json"
21
- spec.add_dependency "yaml"
22
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squarespace_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - cdragon
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: yaml
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  description: Ruby gem interacting with the Squarespace API.
112
98
  email: cdragon1116@gmail.com
113
99
  executables: []