lightspeed_ruby 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lightspeed/api/accounts.rb +17 -0
- data/lib/lightspeed/client.rb +18 -1
- data/lib/lightspeed/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36835acfc096b36433e22cd614acf394f0dff356
|
4
|
+
data.tar.gz: f9ae17a208c3d9f872cf166c39761d7827f4f791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baaa633bc435c683cc66b28f55db97d011f30602b6614679775f13a1be5c7a33380d0462fa63cf15ff9b928d9bbb1b9622242a09cd06eace23028c6cc21aa0ad
|
7
|
+
data.tar.gz: f0b1dc62ab65677519beda89f8e02b7e8f8758d9e6fba60442506e8ae6473f5a11a5dc5dca49db618440138b2df5424e58f93a405e173f0c6a8a1c64c9211199
|
data/lib/lightspeed/client.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require "lightspeed/api/tokens"
|
2
|
+
require "lightspeed/api/accounts"
|
2
3
|
|
3
4
|
module Lightspeed
|
4
5
|
class Client
|
5
|
-
API_BASE = "https://api.merchantos.com/API"
|
6
|
+
API_BASE = "https://api.merchantos.com/API/"
|
6
7
|
|
7
8
|
attr_reader :client_id, :client_secret, :access_token, :refresh_token
|
8
9
|
|
@@ -13,6 +14,22 @@ module Lightspeed
|
|
13
14
|
@refresh_token = refresh_token
|
14
15
|
end
|
15
16
|
|
17
|
+
def get(url, params: {})
|
18
|
+
conn.get(url, params)
|
19
|
+
end
|
20
|
+
|
16
21
|
def tokens; API::Tokens.new(self); end
|
22
|
+
def accounts; API::Accounts.new(self); end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def conn
|
27
|
+
@conn ||= Faraday.new(API_BASE) do |f|
|
28
|
+
f.authorization :Bearer, access_token if access_token
|
29
|
+
f.request :json
|
30
|
+
f.response :json, :content_type => /\bjson$/
|
31
|
+
f.adapter Faraday.default_adapter
|
32
|
+
end
|
33
|
+
end
|
17
34
|
end
|
18
35
|
end
|
data/lib/lightspeed/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightspeed_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zamith
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- bin/console
|
84
84
|
- bin/setup
|
85
85
|
- lib/lightspeed.rb
|
86
|
+
- lib/lightspeed/api/accounts.rb
|
86
87
|
- lib/lightspeed/api/tokens.rb
|
87
88
|
- lib/lightspeed/client.rb
|
88
89
|
- lib/lightspeed/errors/missing_refresh_token.rb
|