magentwo 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0855b02b9cf1761f2dff8aac04d3358904f7285eec5f94de93368825cba7681e'
4
- data.tar.gz: 35cc8a01a17878c7a53e0c29d0d247462b10952779e837a84da2c9a6a8f81937
3
+ metadata.gz: a3a841b7d66c45e36a63b99466fd49e7bedfd056f9077e2cdf2e93dd0b7bf9d1
4
+ data.tar.gz: 46906bc86d4c0da2517334e916e61b0a647d181587324be4a8f5f5058ae3079e
5
5
  SHA512:
6
- metadata.gz: e80b2f28e9327f855d38c43fff6666ac47fac9b3adef74548cf7fa26ff7c299c6cf93fd8e95df0db8ed53ecc2a78c596808233787d7317ab6a89e55c582564a6
7
- data.tar.gz: ffa022044416feab9a526d6608681ea7142c59093d9a4f0b13a14f5b2d43c52016065847cb70362749413c3093f766813f2e82546366c76000a3f539b7048c75
6
+ metadata.gz: aa0c925bd64c60d046266bfed1a8f0c6c1c50ab9f69e2f2b5e5fb6700a5fef715db656a11c65c065f4fae273ba994422c9ec810c3903ffdb671d1d723a9242c0
7
+ data.tar.gz: 2a49d67d5c11fb054d23cc0d2ac24cb87d813c0704111dadeb75cf7a80626139f579f653ae86d7e61789debe02ef2c5951d178bfac0604b121ebfda4e77b236d
data/.gitignore CHANGED
@@ -9,6 +9,8 @@
9
9
  /test/tmp/
10
10
  /test/version_tmp/
11
11
  /tmp/
12
+ /magentwo.rb
13
+ /publish.sh
12
14
 
13
15
  # Used by dotenv library to load environment variables.
14
16
  # .env
@@ -0,0 +1,52 @@
1
+ module Magentwo
2
+ class Adapter < Magentwo::Connection
3
+ DateFields = %i(created_at dob updated_at)
4
+ def call method, path, params
5
+ http_method, params = case method
6
+ when :put, :post, :delete then [method, params.to_json]
7
+ when :get, :get_with_meta_data then [:get, params]
8
+ else
9
+ raise ArgumentError, "unknown method type. Expected :get, :get_with_meta_data, :post, :put or :delete. #{method} #{path}"
10
+ end
11
+
12
+ response = self.send(http_method, path, params)
13
+
14
+ parsed_response = case method
15
+ when :get_with_meta_data, :put, :post, :delete then transform( parse( response))
16
+ when :get
17
+ parsed = parse(response)
18
+ if parsed[:items]
19
+ parsed[:items].map do |item|
20
+ transform item
21
+ end
22
+ else
23
+ transform parsed
24
+ end
25
+ else
26
+ raise ArgumentError, "unknown method type. Expected :get, :get_with_meta_data, :post, :put or :delete. #{method} #{path}"
27
+ end
28
+ end
29
+
30
+ private
31
+ def parse response
32
+ case response.code
33
+ when "200"
34
+ JSON.parse response.body, :symbolize_names => true
35
+ else
36
+ puts "request failed #{response.code} #{response.body}"
37
+ end
38
+ end
39
+
40
+ def transform item
41
+ date_transform item if item
42
+ end
43
+
44
+ def date_transform item
45
+ p "datetransform: #{item}"
46
+ DateFields.each do |date_field|
47
+ item[date_field] = Time.new item[date_field] if item[date_field]
48
+ end
49
+ item
50
+ end
51
+ end
52
+ end
@@ -17,7 +17,6 @@ module Magentwo
17
17
  end
18
18
 
19
19
  def request_token
20
- p self
21
20
  Net::HTTP.start(self.host,self.port) do |http|
22
21
  req = Net::HTTP::Post.new("#{base_path}/integration/admin/token")
23
22
  req.body = {:username=> self.user, :password=> self.password}.to_json
@@ -27,47 +26,49 @@ module Magentwo
27
26
  end
28
27
  end
29
28
 
30
- def call method, path, query:nil
31
- url = "#{base_path}/#{path}?#{query}"
32
- case method
33
- when :get then self.get url
34
- when :post then self.post url
35
- when :delete then self.delete url
36
- when :put then self.put url
37
- else
38
- raise "unknown http method, cannot call #{method}, expected :get, :post, :delete or :put"
39
- end
40
- end
41
-
42
- def delete
29
+ def delete path, data
30
+ Magentwo.logger.info "DELETE #{path}"
31
+ Magentwo.logger.debug "DATA #{data}"
43
32
 
44
- end
45
-
46
- def put
33
+ Magentwo.logger.warn "not implemented"
47
34
 
48
35
  end
49
36
 
50
- def post
51
-
37
+ def put path, data
38
+ Magentwo.logger.info "PUT #{host}/#{base_path}/#{path}"
39
+ Magentwo.logger.debug "DATA #{data}"
40
+ url = "#{base_path}/#{path}"
41
+ Net::HTTP.start(self.host,self.port) do |http|
42
+ req = Net::HTTP::Put.new(url)
43
+ req["Authorization"] = "Bearer #{self.token}"
44
+ req['Content-Type'] = "application/json"
45
+ req.body = data
46
+ http.request(req)
47
+ end
52
48
  end
53
49
 
54
- def get url
55
- p "get: #{url}"
50
+ def post path, data
51
+ Magentwo.logger.info "POST #{host}/#{path}"
52
+ Magentwo.logger.debug "DATA #{data}"
53
+ url = "#{base_path}/#{path}"
56
54
  Net::HTTP.start(self.host,self.port) do |http|
57
- req = Net::HTTP::Get.new(url)
55
+ req = Net::HTTP::Post.new(url)
58
56
  req["Authorization"] = "Bearer #{self.token}"
59
57
  req['Content-Type'] = "application/json"
60
- resp = http.request(req)
61
- handle_response resp
58
+ req.body = data
59
+ http.request(req)
62
60
  end
63
61
  end
64
62
 
65
- private
66
- def handle_response response
67
- case response.code
68
- when "200" then JSON.parse response.body, :symbolize_names => true
69
- else
70
- raise "request failed #{response.code} #{response.body}"
63
+
64
+ def get path, query
65
+ Magentwo.logger.info "GET #{host}#{base_path}/#{path}?#{query}"
66
+ url = "#{base_path}/#{path}?#{query}"
67
+ Net::HTTP.start(self.host,self.port) do |http|
68
+ req = Net::HTTP::Get.new(url)
69
+ req["Authorization"] = "Bearer #{self.token}"
70
+ req['Content-Type'] = "application/json"
71
+ http.request(req)
71
72
  end
72
73
  end
73
74
  end
@@ -7,9 +7,10 @@ module Magentwo
7
7
  :filters => [],
8
8
  :pagination => {
9
9
  :current_page => Filter::CurrentPage.new(1),
10
- :page_size => Filter::PageSize.new(20)
10
+ :page_size => Filter::PageSize.new(Magentwo.default_page_size)
11
11
  },
12
- :ordering => []
12
+ :ordering => [],
13
+ :fields => nil
13
14
  }
14
15
  end
15
16
 
@@ -39,7 +40,7 @@ module Magentwo
39
40
  end
40
41
 
41
42
  def select *fields
42
- Dataset.new self.model, self.opts.merge(:filters => self.opts[:filters] + [Filter::Fields.new(fields)])
43
+ Dataset.new self.model, self.opts.merge(:fields => Filter::Fields.new(fields))
43
44
  end
44
45
 
45
46
  def like args
@@ -49,7 +50,7 @@ module Magentwo
49
50
  #################
50
51
  # Pagination
51
52
  ################
52
- def page page, page_size=20
53
+ def page page, page_size=Magentwo.default_page_size
53
54
  Dataset.new self.model, self.opts.merge(:pagination => {:current_page => Filter::CurrentPage.new(page), :page_size => Filter::PageSize.new(page_size)})
54
55
  end
55
56
 
@@ -64,7 +65,7 @@ module Magentwo
64
65
  # Fetching
65
66
  ################
66
67
  def info
67
- result = self.model.call :get, {:query => self.page(1, 1).to_query}
68
+ result = self.model.get self.page(1, 1).to_query, {:meta_data => true}
68
69
  {
69
70
  :fields => result[:items]&.first&.keys,
70
71
  :total_count => result[:total_count]
@@ -80,16 +81,11 @@ module Magentwo
80
81
  end
81
82
 
82
83
  def first
83
- result = self.model.call :get, {:query => self.page(1, 1).to_query}
84
- self.model.new result[:items].first
84
+ self.model.first self
85
85
  end
86
86
 
87
87
  def all
88
- result = self.model.call :get, {:query => self.to_query}
89
- return [] if result.nil?
90
- (result[:items] || []).map do |item|
91
- self.model.new item
92
- end
88
+ self.model.all self
93
89
  end
94
90
 
95
91
  #################
@@ -110,6 +106,8 @@ module Magentwo
110
106
  self.opts[:ordering]
111
107
  .map { |opt, idx| opt.to_query(idx) }
112
108
  .join("&"),
109
+
110
+ self.opts[:fields]? self.opts[:fields].to_query() : ""
113
111
  ].reject(&:empty?)
114
112
  .join("&")
115
113
  end
@@ -119,12 +117,12 @@ module Magentwo
119
117
  ################
120
118
  def map(&block)
121
119
  raise ArgumentError, "no block given" unless block_given?
122
- self.all.map(&block)
120
+ self.model.all.map(&block)
123
121
  end
124
122
 
125
123
  def each(&block)
126
124
  raise ArgumentError, "no block given" unless block_given?
127
- self.all.each(&block)
125
+ self.model.all.each(&block)
128
126
  end
129
127
  end
130
128
  end
@@ -98,7 +98,7 @@ module Magentwo
98
98
  end
99
99
  def to_query idx=nil
100
100
  #TODO api supports nested field selection e.g. items[address[street]]
101
- "fields=items[#{URI::encode(self.fields.join(","))}]"
101
+ "fields=items[#{URI::encode(self.fields.map(&:to_s).join(","))}]"
102
102
  end
103
103
  end
104
104
  end
@@ -1,17 +1,39 @@
1
1
  require 'uri'
2
2
  require 'net/http'
3
3
  require 'json'
4
+ require 'logger'
4
5
 
5
6
  module Magentwo
6
- Models = %w(base product customer order)
7
+ Models = %w(base product customer order coupon sales_rule)
7
8
  def self.connect host, user_name, password
8
- Base.connection = Connection.new host, user_name, password
9
+ Base.adapter = Adapter.new host, user_name, password
9
10
  end
11
+
12
+ def self.logger= logger
13
+ @@logger = logger
14
+ end
15
+
16
+ def self.logger
17
+ @@logger ||= Logger.new STDOUT, {:level => Logger::DEBUG}
18
+ end
19
+
20
+ def self.default_page_size
21
+ @@default_page_size ||= 20
22
+ end
23
+
24
+ def self.default_page_size= page_size
25
+ @@default_page_size = page_size
26
+ end
27
+
28
+
10
29
  end
11
30
 
12
31
  require_relative 'connection.rb'
32
+ require_relative 'adapter.rb'
13
33
  require_relative 'filter.rb'
14
34
  require_relative 'dataset.rb'
35
+ require_relative 'util/validator.rb'
36
+
15
37
  Magentwo::Models.each do |file_name|
16
38
  require_relative("model/#{file_name}.rb")
17
39
  end
@@ -1,6 +1,8 @@
1
1
  module Magentwo
2
2
  class Base
3
- DatasetMethods = %i(all filter exclude select fields first count fields info page order_by like)
3
+ DatasetMethods = %i(filter exclude select fields count fields info page order_by like)
4
+
5
+ attr_accessor :base_path
4
6
 
5
7
  def initialize args
6
8
  args.each do |key, value|
@@ -9,23 +11,81 @@ module Magentwo
9
11
  instance_variable_set key_sym, value
10
12
  end
11
13
  end
12
- if self.respond_to? :custom_attributes
14
+ if self.respond_to?(:custom_attributes) && args[:custom_attributes]
13
15
  self.custom_attributes = args[:custom_attributes].map do |attr|
14
16
  Hash[attr[:attribute_code].to_sym, attr[:value]]
15
17
  end.inject(&:merge)
16
18
  end
17
19
  end
18
20
 
19
- def call method, path, query:nil
20
- Magentwo::Base.call method, path, {:query => query}
21
+ def save
22
+ self.validate
23
+ response = Magentwo::Base.call :put, "#{self.class.base_path}/#{self.id}", self
24
+ self.class.new response
25
+ end
26
+
27
+ def delete
28
+ Magentwo.logger.warn "not implemented"
29
+ end
30
+
31
+ def validate
32
+ true
33
+ end
34
+
35
+ def check_presence *attributes
36
+ Magentwo::Validator.check_presence self, *attributes
21
37
  end
22
38
 
23
- class << self; attr_accessor :connection end
39
+ def call method, path, params
40
+ self.class.call method, path, params
41
+ end
42
+
43
+ def to_h
44
+ self.instance_variables.map do |k|
45
+ key = k.to_s[1..-1] #symbol to string and remove @ in front
46
+ if key == "custom_attributes"
47
+ [
48
+ key,
49
+ self.send(key).map do |k, v|
50
+ {:attribute_code => k, :value => v}
51
+ end
52
+ ]
53
+ else
54
+ [key, self.send(key)]
55
+ end
56
+ end
57
+ .to_h
58
+ end
59
+
60
+ def to_json
61
+ Hash[self.class.lower_case_name, self.to_h].to_json
62
+ end
24
63
 
25
64
  class << self
26
- #args may container searchCriteria, fields, ...
27
- def call method, path="#{self.name.split("::").last.downcase}s", query:nil
28
- Magentwo::Base.connection.call method, path, {:query => query}
65
+ attr_accessor :adapter
66
+
67
+ def lower_case_name
68
+ name = self.name.split(/::/).last
69
+ "#{name[0,1].downcase}#{name[1..-1]}"
70
+ end
71
+
72
+ def base_path
73
+ "#{lower_case_name}s"
74
+ end
75
+
76
+ def get_path
77
+ base_path
78
+ end
79
+
80
+ def all ds=self.dataset
81
+ self.get(ds.to_query)
82
+ .map do |item|
83
+ self.new item
84
+ end
85
+ end
86
+
87
+ def first ds=self.dataset
88
+ self.new self.get(ds.page(1, 1).to_query).first
29
89
  end
30
90
 
31
91
  def dataset
@@ -37,6 +97,20 @@ module Magentwo
37
97
  return dataset.send(name, *args)
38
98
  end
39
99
  end
100
+
101
+ def get query, path:self.get_path, meta_data:false
102
+ case meta_data
103
+ when true then self.call :get_with_meta_data, path, query
104
+ when false then self.call :get, path, query
105
+ else
106
+ raise ArgumentError "unknown meta_data param, expected bool value. got: #{meta_data}"
107
+ end
108
+ end
109
+
110
+ def call method, path=self.base_path, params
111
+ Magentwo::Base.adapter.call(method, path, params)
112
+ end
113
+
40
114
  end
41
115
  end
42
116
  end
@@ -0,0 +1,29 @@
1
+ module Magentwo
2
+ class Coupon < Base
3
+ Attributes = %i(coupon_id rule_id code usage_per_customer times_used is_primary type)
4
+ Attributes.each do |attr| attr_accessor attr end
5
+
6
+ class << self
7
+ def get_path
8
+ "#{base_path}/search"
9
+ end
10
+
11
+ def generate rule_id, quantity:1, length:16, format:(:alpha), delimiter:"-", delimiter_at_every:4
12
+ format = format.to_sym
13
+ Magentwo::Validator.one_of format, :num, :alpha, :alphanum
14
+ self.call :post, "coupons/generate",
15
+ {
16
+ :couponSpec => {
17
+ :rule_id => rule_id,
18
+ :quantity => quantity,
19
+ :length => length,
20
+ :format => format,
21
+ :delimiter => delimiter,
22
+ :delimiter_at_every => delimiter_at_every
23
+ }
24
+ }
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -1,18 +1,20 @@
1
1
  module Magentwo
2
2
  class Customer < Base
3
3
  Attributes = %i(id group_id default_billing default_shipping created_at updated_at created_in dob email firstname lastname gender store_id website_id addresses disable_auto_group_change extension_attributes)
4
+ Attributes.each do |attr| attr_accessor attr end
4
5
 
5
- Attributes.each do |attr|
6
- attr_accessor attr
6
+ def with_extension_attributes
7
+ self.class.new (self.class.get nil, path:"#{self.class.base_path}/#{self.id}")
7
8
  end
8
9
 
9
- def with_extension_attributes
10
- Magentwo::Customer.new( self.call :get, "customers/#{self.id}")
10
+ def validate
11
+ check_presence :email
12
+ super
11
13
  end
12
14
 
13
15
  class << self
14
- def call method, path="customers/search", query:nil
15
- Magentwo::Base.connection.call method, path, {:query => query}
16
+ def get_path
17
+ "#{base_path}/search"
16
18
  end
17
19
  end
18
20
  end
@@ -1,9 +1,6 @@
1
1
  module Magentwo
2
2
  class Product < Base
3
3
  Attributes = %i(id sku name attribute_set_id price status visibility type_id created_at updated_at extension_attributes product_links options media_gallery_entries tier_prices custom_attributes)
4
-
5
- Attributes.each do |attr|
6
- attr_accessor attr
7
- end
4
+ Attributes.each do |attr| attr_accessor attr end
8
5
  end
9
6
  end
@@ -0,0 +1,13 @@
1
+ module Magentwo
2
+ class SalesRule < Base
3
+ Attributes = %i(rule_id name store_labels description website_ids customer_group_ids uses_per_customer is_active condition action_condition stop_rules_processing is_advanced sort_order simple_action discount_amount discount_step apply_to_shipping times_used is_rss coupon_type use_auto_generation uses_per_coupon simple_free_shipping)
4
+ Attributes.each do |attr| attr_accessor attr end
5
+
6
+ class << self
7
+ def get_path
8
+ "#{base_path}/search"
9
+ end
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ module Magentwo
2
+ class Validator
3
+ class << self
4
+ def check_presence model, *attributes
5
+ case model
6
+ when Hash
7
+ attributes.each do |attribute|
8
+ raise ArgumentError, "#{attribute} must be set" unless model[attribute]
9
+ end
10
+ when Magentwo::Base
11
+ attributes.each do |attribute|
12
+ raise ArgumentError, "#{attribute} must be set" unless model.send(attribute)
13
+ end
14
+ else
15
+ raise ArgumentError, "unknown model type, expected Child of Magentwo::Base or Hash"
16
+ end
17
+ end
18
+
19
+ def one_of value, *valid_values
20
+ raise ArgumentError, "value #{value} invalid, expected one of #{valid_values}" unless valid_values.include?value
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,12 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'magentwo'
3
- s.version = '0.1.3'
3
+ s.version = '0.1.4'
4
4
  s.date = '2019-01-17'
5
5
  s.summary = "Magento 2 API Wrapper"
6
6
  s.description = "Provides a simple Ruby Interface to interact with the Magento 2 API"
7
7
  s.authors = ["André Mueß"]
8
8
  s.email = 'andre.cux90@gmail.com'
9
9
  s.license = 'MIT'
10
- s.homepage = "https://github.com/Arkad82x/magentwo"
10
+ s.homepage = "https://rubygems.org/gems/magentwo"
11
+ s.metadata = { "source_code_uri" => "https://github.com/Arkad82x/magentwo" }
11
12
  s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
12
13
  end
@@ -0,0 +1,68 @@
1
+ require_relative '../lib/magentwo.rb'
2
+
3
+ describe Magentwo::Dataset do
4
+ let(:dataset) {Magentwo::Dataset.new Magentwo::Product}
5
+ context "Initial Dataset" do
6
+ let(:initial_query) {dataset.to_query}
7
+ it "has opts" do
8
+ expect(dataset).to respond_to :opts
9
+ expect(dataset.opts).to have_key :pagination
10
+ expect(dataset.opts).to have_key :ordering
11
+ expect(dataset.opts).to have_key :filters
12
+ end
13
+ it "has model" do
14
+ expect(dataset).to respond_to :model
15
+ expect(dataset.model).to eq Magentwo::Product
16
+ end
17
+ it "has default pagination" do
18
+ expect(dataset.opts[:pagination]).to have_key :current_page
19
+ expect(dataset.opts[:pagination]).to have_key :page_size
20
+ end
21
+ it "requests #{Magentwo::Dataset::DefaultPageSize} items on default" do
22
+ expect(initial_query).to include "searchCriteria[current_page]=1"
23
+ expect(initial_query).to include "searchCriteria[page_size]=#{Magentwo::Dataset::DefaultPageSize}"
24
+ end
25
+ end
26
+
27
+ context "simple name filter" do
28
+ let(:name_filter_ds) {dataset.filter({:name => "foobar"})}
29
+ let(:name_filter_query) {name_filter_ds.to_query}
30
+ it "adds filter" do
31
+ expect(name_filter_ds.opts[:filters]).to include Magentwo::Filter::Eq
32
+ end
33
+ it "computes query" do
34
+ expect(name_filter_query).to include "searchCriteria[filter_groups][0][filters][0][field]=name"
35
+ expect(name_filter_query).to include "searchCriteria[filter_groups][0][filters][0][condition_type]=eq"
36
+ expect(name_filter_query).to include "searchCriteria[filter_groups][0][filters][0][value]=foobar"
37
+ end
38
+ end
39
+
40
+ context "select" do
41
+ let(:name_select_ds) {dataset.select(:name)}
42
+ let(:name_select_query) {name_select_ds.to_query}
43
+ let(:multi_field_select_ds) {dataset.select(:field1, :field2)}
44
+ let(:multi_field_select_query) {multi_field_select_ds.to_query}
45
+ it "adds filter" do
46
+ expect(name_select_ds.opts[:fields]).to be_an_instance_of Magentwo::Filter::Fields
47
+ end
48
+ it "computes name select query" do
49
+ expect(name_select_query).to include "fields=items[name]"
50
+ end
51
+ it "adds multiple fields" do
52
+ expect(multi_field_select_ds.opts).to have_key :fields
53
+ expect(multi_field_select_ds.opts[:fields]).to be_an_instance_of Magentwo::Filter::Fields
54
+ expect(multi_field_select_ds.opts[:fields].fields).to include :field1
55
+ expect(multi_field_select_ds.opts[:fields].fields).to include :field2
56
+ end
57
+ it "computes multi select query" do
58
+ expect(multi_field_select_query).to include "fields=items[field1,field2]"
59
+ end
60
+ end
61
+
62
+ context "URL encoding" do
63
+ let(:filter_query_with_spaces) {dataset.filter({:name => "Hello there, lets add some spaces here"}).to_query}
64
+ it "encodes spaces" do
65
+ expect(filter_query_with_spaces).to include "%20"
66
+ end
67
+ end
68
+ end
@@ -1,8 +1,4 @@
1
1
  require_relative '../lib/magentwo.rb'
2
2
 
3
- describe 'product' do
4
- Magentwo::Base.connection = Magentwo::Connection.new('magento2.local',"admin","magentorocks1")
5
- it 'returns an array when list is called' do
6
- expect(Magentwo::Product.list.class).to eq Array
7
- end
3
+ describe Magentwo::Product do
8
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magentwo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Mueß
@@ -21,25 +21,28 @@ files:
21
21
  - Gemfile
22
22
  - LICENSE
23
23
  - README.md
24
+ - lib/adapter.rb
24
25
  - lib/connection.rb
25
26
  - lib/dataset.rb
26
27
  - lib/filter.rb
27
28
  - lib/magentwo.rb
28
29
  - lib/model/base.rb
30
+ - lib/model/coupon.rb
29
31
  - lib/model/customer.rb
30
32
  - lib/model/order.rb
31
33
  - lib/model/product.rb
34
+ - lib/model/sales_rule.rb
35
+ - lib/util/validator.rb
32
36
  - magentwo.gemspec
33
- - magentwo.rb
34
37
  - spec/base_model_spec.rb
35
38
  - spec/dataset_spec.rb
36
39
  - spec/product_spec.rb
37
- - spec/server_spec.rb
38
40
  - spec/spec_helper.rb
39
- homepage: https://github.com/Arkad82x/magentwo
41
+ homepage: https://rubygems.org/gems/magentwo
40
42
  licenses:
41
43
  - MIT
42
- metadata: {}
44
+ metadata:
45
+ source_code_uri: https://github.com/Arkad82x/magentwo
43
46
  post_install_message:
44
47
  rdoc_options: []
45
48
  require_paths:
@@ -1,6 +0,0 @@
1
- require 'pry'
2
- require_relative 'lib/magentwo.rb'
3
-
4
- Magentwo.connect 'magento2.local',"admin","magentorocks1"
5
-
6
- binding.pry
@@ -1,7 +0,0 @@
1
- require_relative '../lib/model/base.rb'
2
-
3
- describe 'setup' do
4
- before do
5
- Magentwo::Base.connection = Magentwo::Connection.new('magento2.local',"admin","magentorocks1")
6
- end
7
- end