magento 0.30.0 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -1
- data/lib/magento/customer.rb +33 -0
- data/lib/magento/shared/title.rb +3 -0
- data/lib/magento/tax_rate.rb +16 -0
- data/lib/magento/tax_rule.rb +16 -0
- data/lib/magento/version.rb +1 -1
- data/lib/magento.rb +2 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc9ad161c82e02dd0daaa2e8f6b24dfba7111df4e8609035f9d286538c6ae020
|
4
|
+
data.tar.gz: 3f9f0d37e0cfabb0d066c95ee6e092e72b19ec8f2280366d1df46fed9727902f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72851026859b037633935af3dc83d7a32ae2269785a677377bc334827270d1794e2084bf2e86c2826bbff023c047618d27e934d2c17266de720fa78318cb8acb
|
7
|
+
data.tar.gz: f02efe20c7cb6b52628cd4e4833184f7b3ccda2ed6901de0f0169e48ec51692fa1433eb595fedf0f005be649e7ceb3d5848c6b3d4b12e7c3cf82fcb0e2b0511f
|
data/README.md
CHANGED
@@ -55,6 +55,8 @@ Ruby library to consume the magento 2 api
|
|
55
55
|
|
56
56
|
[Customer](#customer)
|
57
57
|
- [Find by token](#get-customer-by-token)
|
58
|
+
- [Login](#customer-login)
|
59
|
+
- [Reset Password](#customer-reset-password)
|
58
60
|
|
59
61
|
[Guest cart](#guest-cart)
|
60
62
|
- [Payment information](#payment-information)
|
@@ -77,7 +79,7 @@ Ruby library to consume the magento 2 api
|
|
77
79
|
Add in your Gemfile
|
78
80
|
|
79
81
|
```rb
|
80
|
-
gem 'magento', '~> 0.
|
82
|
+
gem 'magento', '~> 0.31.0'
|
81
83
|
```
|
82
84
|
|
83
85
|
or run
|
@@ -916,6 +918,26 @@ Magento::SalesRule.generate_coupon(
|
|
916
918
|
Magento::Customer.find_by_token('user_token')
|
917
919
|
```
|
918
920
|
|
921
|
+
### Customer login
|
922
|
+
Exemple:
|
923
|
+
```rb
|
924
|
+
Magento::Customer.login('username', 'password')
|
925
|
+
|
926
|
+
>> 'aj8oer4eQi44FrghgfhVdbBKN' #return user token
|
927
|
+
```
|
928
|
+
|
929
|
+
### Customer reset password
|
930
|
+
Exemple:
|
931
|
+
```rb
|
932
|
+
Magento::Customer.reset_password(
|
933
|
+
email: 'user_email',
|
934
|
+
reset_token: 'user_reset_token',
|
935
|
+
new_password: 'user_new_password'
|
936
|
+
)
|
937
|
+
|
938
|
+
>> true # return true on success
|
939
|
+
```
|
940
|
+
|
919
941
|
## Guest Cart
|
920
942
|
|
921
943
|
### Payment information
|
data/lib/magento/customer.rb
CHANGED
@@ -42,6 +42,39 @@ module Magento
|
|
42
42
|
hash = request.get("customers/#{id}").parse
|
43
43
|
build(hash)
|
44
44
|
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Log in to a user account
|
48
|
+
#
|
49
|
+
# Example:
|
50
|
+
# Magento::Customer.login('customer@gmail.com', '123456')
|
51
|
+
#
|
52
|
+
# @return String: return the user token
|
53
|
+
def login(username, password)
|
54
|
+
request.post("integration/customer/token", {
|
55
|
+
username: username,
|
56
|
+
password: password
|
57
|
+
})
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# Reset a user's password
|
62
|
+
#
|
63
|
+
# Example:
|
64
|
+
# Magento::Customer.reset_password(
|
65
|
+
# email: 'customer@gmail.com',
|
66
|
+
# reset_token: 'mEKMTciuhPfWkQ3zHTCLIJNC',
|
67
|
+
# new_password: '123456'
|
68
|
+
# )
|
69
|
+
#
|
70
|
+
# @return Bolean: true on success, raise exception otherwise
|
71
|
+
def reset_password(email:, reset_token:, new_password:)
|
72
|
+
request.post("customers/resetPassword", {
|
73
|
+
email: email,
|
74
|
+
reset_token: reset_token,
|
75
|
+
new_password: new_password
|
76
|
+
}).parse
|
77
|
+
end
|
45
78
|
end
|
46
79
|
end
|
47
80
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Magento
|
4
|
+
class TaxRate < Model
|
5
|
+
self.primary_key = :id
|
6
|
+
self.endpoint = 'taxRates'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
protected
|
10
|
+
|
11
|
+
def query
|
12
|
+
Query.new(self, api_resource: 'taxRates/search')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Magento
|
4
|
+
class TaxRule < Model
|
5
|
+
self.primary_key = :id
|
6
|
+
self.endpoint = 'taxRules'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
protected
|
10
|
+
|
11
|
+
def query
|
12
|
+
Query.new(self, api_resource: 'taxRules/search')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/magento/version.rb
CHANGED
data/lib/magento.rb
CHANGED
@@ -26,6 +26,8 @@ require_relative 'magento/sales_rule'
|
|
26
26
|
require_relative 'magento/inventory'
|
27
27
|
require_relative 'magento/import'
|
28
28
|
require_relative 'magento/cart'
|
29
|
+
require_relative 'magento/tax_rule'
|
30
|
+
require_relative 'magento/tax_rate'
|
29
31
|
|
30
32
|
require_relative 'magento/params/create_custom_attribute'
|
31
33
|
require_relative 'magento/params/create_image'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magento
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wallas Faria
|
@@ -153,8 +153,11 @@ files:
|
|
153
153
|
- lib/magento/shared/status_history.rb
|
154
154
|
- lib/magento/shared/stock_item.rb
|
155
155
|
- lib/magento/shared/tier_price.rb
|
156
|
+
- lib/magento/shared/title.rb
|
156
157
|
- lib/magento/shared/total.rb
|
157
158
|
- lib/magento/shared/value.rb
|
159
|
+
- lib/magento/tax_rate.rb
|
160
|
+
- lib/magento/tax_rule.rb
|
158
161
|
- lib/magento/version.rb
|
159
162
|
- magento.gemspec
|
160
163
|
- spec/magento/core/model_mapper_spec.rb
|