magento 0.9.1 → 0.13.0

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.
@@ -69,7 +69,7 @@ module Magento
69
69
 
70
70
  def save_request(method, url, body = nil)
71
71
  begin
72
- body = body[:product].reject { |e| e == :media_gallery_entries }
72
+ body = body.symbolize_keys[:product].reject { |e| e == :media_gallery_entries }
73
73
  rescue StandardError
74
74
  end
75
75
 
@@ -0,0 +1,32 @@
1
+ module Magento
2
+ class SalesRule < Model
3
+ self.primary_key = :rule_id
4
+ self.entity_key = :rule
5
+ self.endpoint = 'salesRules'
6
+
7
+ # Example
8
+ # rule = Magento::SalesRule.find(5)
9
+ # rule.generate_coupon(quantity: 1, length: 10)
10
+ #
11
+ # @return {String[]}
12
+ def generate_coupon(attributes)
13
+ body = { couponSpec: { rule_id: id }.merge(attributes) }
14
+ self.class.generate_coupon(body)
15
+ end
16
+
17
+ class << self
18
+ # Example
19
+ # Magento::SalesRule.generate_coupon(
20
+ # couponSpec: {
21
+ # rule_id: 5,
22
+ # quantity: 1,
23
+ # length: 10
24
+ # }
25
+ # )
26
+ # @return {String[]}
27
+ def generate_coupon(attributes)
28
+ request.post('coupons/generate', attributes).parse
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,4 @@
1
+ module Magento
2
+ class ActionCondition
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Magento
2
+ class Condition
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module Magento
2
- VERSION = '0.9.1'
2
+ VERSION = '0.13.0'
3
3
  end
@@ -19,4 +19,7 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_dependency 'dry-inflector', '~> 0.2.0'
21
21
  s.add_dependency 'http', '~> 4.4'
22
+ s.add_dependency 'dry-struct'
23
+ s.add_dependency 'activesupport'
24
+ s.add_dependency 'mini_magick'
22
25
  end
@@ -19,4 +19,7 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_dependency 'http', '~> 4.4'
21
21
  s.add_dependency 'dry-inflector', '~> 0.2.0'
22
+ s.add_dependency 'dry-struct'
23
+ s.add_dependency 'activesupport'
24
+ s.add_dependency 'mini_magick'
22
25
  end
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.9.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wallas Faria
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-struct
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activesupport
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mini_magick
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  description: Magento Ruby library
42
84
  email: wallasfaria@hotmail.com
43
85
  executables: []
@@ -58,17 +100,25 @@ files:
58
100
  - lib/magento/model.rb
59
101
  - lib/magento/model_mapper.rb
60
102
  - lib/magento/order.rb
103
+ - lib/magento/params.rb
104
+ - lib/magento/params/create_category.rb
105
+ - lib/magento/params/create_custom_attribute.rb
106
+ - lib/magento/params/create_image.rb
107
+ - lib/magento/params/create_product.rb
61
108
  - lib/magento/polymorphic_model.rb
62
109
  - lib/magento/product.rb
63
110
  - lib/magento/query.rb
64
111
  - lib/magento/record_collection.rb
65
112
  - lib/magento/request.rb
113
+ - lib/magento/sales_rule.rb
114
+ - lib/magento/shared/action_condition.rb
66
115
  - lib/magento/shared/address.rb
67
116
  - lib/magento/shared/available_regions.rb
68
117
  - lib/magento/shared/billing_address.rb
69
118
  - lib/magento/shared/bundle_product_option.rb
70
119
  - lib/magento/shared/category_link.rb
71
120
  - lib/magento/shared/comment.rb
121
+ - lib/magento/shared/condition.rb
72
122
  - lib/magento/shared/configurable_product_option.rb
73
123
  - lib/magento/shared/currency.rb
74
124
  - lib/magento/shared/custom_attribute.rb