spendee-rb 0.0.1 → 0.0.2

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: d731985e96c2c4900f978ca3d0dc9bc2d2462cde6930fa7c9151ca6585b4b359
4
- data.tar.gz: a67eeea117b90cb377bd76af2e591d3ef1518fac8424b89b01bad90bc824811a
3
+ metadata.gz: 14949bc4b80e195fe46c2c54d43312904b7b0aad5df8fa1c9b79485bbd1a16b2
4
+ data.tar.gz: b04ecd3792f051efe54a7de4dda31cd2596ecf9cdb5ea10f3497acb9f90ab8e1
5
5
  SHA512:
6
- metadata.gz: b908843096d1866695dd7a63ef31608ce97f06f4432beb6c1dcb5c22b7376ff3f4539657a2332be13418e36d0e929051a34d4eb7a7c867a9bf2204d1682a966e
7
- data.tar.gz: ca10fa0448ad5e4d3bf1c75cd4333dcdf6159a470e8dd75527c0237e30f5a49c258723d929e5ccf9385cc41cd05d54dcd2a46dafa26e2551ad1abec77a52f9cb
6
+ metadata.gz: 344268880cd56d68509f7dcc9f134c2ca3b9599094fa8f9c1202a5413ccc658251d38fc6ef27c2db49801268edd6e01645fd606503b8be0686100ced78e40c27
7
+ data.tar.gz: e5266f338780fa0ae41ec0651d1df2a6360cc565ef98063217d08f33184f7d4b69ce9dbea1397daf47a711c3ede40580e0023dc9d96f4a079030e67ccb8ced0c
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
+ require 'pry'
4
5
  require 'spendee-rb'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
@@ -16,7 +16,8 @@ module Spendee
16
16
  module Clients
17
17
  autoload :BaseClient, 'spendee/clients/base_client'
18
18
 
19
- autoload :UserLogin, 'spendee/clients/user_login'
19
+ autoload :VerifyIdentity, 'spendee/clients/verify_identity'
20
+ autoload :Login, 'spendee/clients/login'
20
21
  autoload :UserGetProfile, 'spendee/clients/user_get_profile'
21
22
  autoload :WalletGetAll, 'spendee/clients/wallet_get_all'
22
23
  autoload :WalletGetTransactions, 'spendee/clients/wallet_get_transactions'
@@ -24,7 +25,8 @@ module Spendee
24
25
  autoload :GetAllUserCategories, 'spendee/clients/get_all_user_categories'
25
26
  end
26
27
 
27
- autoload :UserLogin, 'spendee/user_login'
28
+ autoload :VerifyIdentity, 'spendee/verify_identity'
29
+ autoload :Login, 'spendee/login'
28
30
  autoload :UserProfile, 'spendee/user_profile'
29
31
  autoload :Wallet, 'spendee/wallet'
30
32
  autoload :Transaction, 'spendee/transaction'
@@ -3,10 +3,8 @@
3
3
  module Spendee
4
4
  module Clients
5
5
  class BaseClient < ApiStruct::Client
6
- API_UUID = 'API-UUID'
7
-
8
- def default_headers(api_uuid)
9
- { API_UUID => api_uuid }
6
+ def default_headers(token, device_uuid = nil)
7
+ { authorization: "Bearer #{token}", 'content-type': 'application/json', 'device-uuid': device_uuid}
10
8
  end
11
9
  end
12
10
  end
@@ -1,10 +1,10 @@
1
1
  module Spendee
2
2
  module Clients
3
3
  class GetAllUserCategories < BaseClient
4
- spendee_api 'get-all-user-categories'
4
+ spendee_api 'v1.8/get-all-user-categories'
5
5
 
6
- def index(api_uuid)
7
- get(headers: default_headers(api_uuid))
6
+ def index(token, device_uuid)
7
+ get(headers: default_headers(token, device_uuid))
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,19 @@
1
+ module Spendee
2
+ module Clients
3
+ class Login < BaseClient
4
+ spendee_api 'v3/auth/login'
5
+
6
+ def create(token, global_currency:, default_wallet_name:, timezone:, platform:)
7
+ post(
8
+ body: {
9
+ global_currency: global_currency,
10
+ default_wallet_name: default_wallet_name,
11
+ timezone: timezone,
12
+ platform: platform
13
+ }.to_json,
14
+ headers: default_headers(token)
15
+ )
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,10 +1,10 @@
1
1
  module Spendee
2
2
  module Clients
3
3
  class UserGetProfile < BaseClient
4
- spendee_api 'user-get-profile'
4
+ spendee_api 'v1.8/user-get-profile'
5
5
 
6
- def show(api_uuid)
7
- post(headers: default_headers(api_uuid))
6
+ def show(token, device_uuid)
7
+ post(headers: default_headers(token, device_uuid))
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,18 @@
1
+ module Spendee
2
+ module Clients
3
+ class VerifyIdentity < ApiStruct::Client
4
+ googleapis 'verifyPassword'
5
+
6
+ def create(email:, password:, key:)
7
+ post(
8
+ params: { key: key },
9
+ body: {
10
+ email: email,
11
+ password: password,
12
+ returnSecureToken: true
13
+ }.to_json
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,9 +1,9 @@
1
1
  module Spendee
2
2
  module Clients
3
3
  class WalletCreateTransaction < BaseClient
4
- spendee_api 'wallet-create-transaction'
4
+ spendee_api 'v1.8/wallet-create-transaction'
5
5
 
6
- def create(api_uuid, amount:, start_date:, wallet_id:, note:, category_id:, timezone:, offset:)
6
+ def create(token, device_uuid, amount:, start_date:, wallet_id:, note:, category_id:, timezone:, offset:)
7
7
  post(
8
8
  body: {
9
9
  amount: amount,
@@ -14,7 +14,7 @@ module Spendee
14
14
  timezone: timezone,
15
15
  offset: offset
16
16
  }.to_json,
17
- headers: default_headers(api_uuid)
17
+ headers: default_headers(token, device_uuid)
18
18
  )
19
19
  end
20
20
  end
@@ -1,10 +1,10 @@
1
1
  module Spendee
2
2
  module Clients
3
3
  class WalletGetAll < BaseClient
4
- spendee_api 'wallet-get-all'
4
+ spendee_api 'v1.8/wallet-get-all'
5
5
 
6
- def index(api_uuid)
7
- post(headers: default_headers(api_uuid))
6
+ def index(token, device_uuid)
7
+ post(headers: default_headers(token, device_uuid))
8
8
  end
9
9
  end
10
10
  end
@@ -1,10 +1,10 @@
1
1
  module Spendee
2
2
  module Clients
3
3
  class WalletGetTransactions < BaseClient
4
- spendee_api 'wallet-get-transactions'
4
+ spendee_api 'v1.8/wallet-get-transactions'
5
5
 
6
- def index(api_uuid)
7
- post(headers: default_headers(api_uuid))
6
+ def index(token, device_uuid)
7
+ post(headers: default_headers(token, device_uuid))
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,7 @@
1
+ module Spendee
2
+ module Entities
3
+ class Identity < ApiStruct::Entity
4
+ attr_entity :id_token
5
+ end
6
+ end
7
+ end
@@ -1,7 +1,13 @@
1
1
  ApiStruct::Settings.configure do |config|
2
2
  config.endpoints = {
3
3
  spendee_api: {
4
- root: 'https://api.spendee.com/v1.8'
5
- }
4
+ root: 'https://api.spendee.com',
5
+ },
6
+ googleapis: {
7
+ root: 'https://www.googleapis.com/identitytoolkit/v3/relyingparty',
8
+ headers: {
9
+ 'content-type': 'application/json'
10
+ }
11
+ },
6
12
  }
7
13
  end
@@ -0,0 +1,9 @@
1
+ module Spendee
2
+ class Login < ApiStruct::Entity
3
+ client_service Spendee::Clients::Login
4
+
5
+ has_entity :user_profile, as: Spendee::Entities::User
6
+
7
+ attr_entity :device_uuid
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Spendee
2
+ class VerifyIdentity < ApiStruct::Entity
3
+ client_service Spendee::Clients::VerifyIdentity
4
+
5
+ attr_entity :id_token
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spendee
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spendee-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taras Shpachenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-05 00:00:00.000000000 Z
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api_struct
@@ -191,20 +191,23 @@ files:
191
191
  - lib/spendee/category.rb
192
192
  - lib/spendee/clients/base_client.rb
193
193
  - lib/spendee/clients/get_all_user_categories.rb
194
+ - lib/spendee/clients/login.rb
194
195
  - lib/spendee/clients/user_get_profile.rb
195
- - lib/spendee/clients/user_login.rb
196
+ - lib/spendee/clients/verify_identity.rb
196
197
  - lib/spendee/clients/wallet_create_transaction.rb
197
198
  - lib/spendee/clients/wallet_get_all.rb
198
199
  - lib/spendee/clients/wallet_get_transactions.rb
199
200
  - lib/spendee/create_transaction.rb
200
201
  - lib/spendee/entities/category.rb
202
+ - lib/spendee/entities/identity.rb
201
203
  - lib/spendee/entities/transaction.rb
202
204
  - lib/spendee/entities/user.rb
203
205
  - lib/spendee/entities/wallet.rb
204
206
  - lib/spendee/initializers/api_struct.rb
207
+ - lib/spendee/login.rb
205
208
  - lib/spendee/transaction.rb
206
- - lib/spendee/user_login.rb
207
209
  - lib/spendee/user_profile.rb
210
+ - lib/spendee/verify_identity.rb
208
211
  - lib/spendee/version.rb
209
212
  - lib/spendee/wallet.rb
210
213
  - spendee-rb.gemspec
@@ -226,8 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
229
  - !ruby/object:Gem::Version
227
230
  version: '0'
228
231
  requirements: []
229
- rubyforge_project:
230
- rubygems_version: 2.7.3
232
+ rubygems_version: 3.1.2
231
233
  signing_key:
232
234
  specification_version: 4
233
235
  summary: Spendee API ruby client.
@@ -1,17 +0,0 @@
1
- module Spendee
2
- module Clients
3
- class UserLogin < BaseClient
4
- spendee_api 'user-login'
5
-
6
- def create(email:, password:)
7
- post(
8
- body: {
9
- email: email,
10
- password: password,
11
- device_uuid: ''
12
- }.to_json
13
- )
14
- end
15
- end
16
- end
17
- end
@@ -1,7 +0,0 @@
1
- module Spendee
2
- class UserLogin < ApiStruct::Entity
3
- client_service Spendee::Clients::UserLogin
4
-
5
- has_entity :result, as: Spendee::Entities::User
6
- end
7
- end