catalogapi 0.1.0rc3 → 0.1.0

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: 91c8c334b9c9b110b34a6ec34cde429a3c02bef8cf9dfcd9093fe9f8da97875c
4
- data.tar.gz: 6e0d5d305f2367031a47d21cf8233db81546f11a864c41c0cdffd4ea12c31b56
3
+ metadata.gz: a97c95a542bc5eff4e1ad8a95cbbddd760b152b22714c991716f29617b54b2ab
4
+ data.tar.gz: cdaa69867af988890cb39f2eef877d05706c9f5a2097f68bdcb5e07a0742b2c1
5
5
  SHA512:
6
- metadata.gz: ba3db14f7cb840fb3654ae4bb41d465ffc49f515e56a1c295b8da59752540dadcbb3c068253a45d55fbb364f49626430f66c4bad2d9952b75d8bc1338f34d3ac
7
- data.tar.gz: 99ea40bf382cfd2ee0b49909dde66014dcc307389cf7414af3bfd369737f2be7cc82117845fb985ec1b93f19b170f8881420c63d15152a91bc15c45f81873d5c
6
+ metadata.gz: 5d064d9d8e64a011282233d8f7f340121f5cb45ab090a750eb84effb1d634b8d9c786be938e4f6bbff092d3c50320251343445f01a1503a7f39a6e5f6195ca6f
7
+ data.tar.gz: c8a3975c77514a73eb19ba12b4937213478edb604bff2438ffd13e857af726e82132cc068da17094a91bd44288b09eac6f611a48d20ffeb15e09948cc5a976a6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catalogapi (0.1.0rc3)
4
+ catalogapi (0.1.0)
5
5
  http (~> 4.0)
6
6
 
7
7
  GEM
@@ -3,7 +3,10 @@
3
3
  require 'catalogapi/request'
4
4
  require 'catalogapi/catalog'
5
5
  require 'catalogapi/category'
6
+ require 'catalogapi/order_item'
7
+ require 'catalogapi/fulfillment'
6
8
  require 'catalogapi/item'
9
+ require 'catalogapi/metadata'
7
10
  require 'catalogapi/order'
8
11
  require 'catalogapi/version'
9
12
 
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CatalogAPI
4
+ class Fulfillment
5
+ attr_reader :fulfillment_date, :items, :metadata
6
+ def initialize(opts)
7
+ @fulfillment_date = opts[:fulfillment_date]
8
+ @items = opts.dig(:items, :FulfillmentItem).to_a.map { |i| CatalogAPI::OrderItem.new(i) }
9
+ @metadata = opts.dig(:metadata, :Meta).to_a.map { |i| CatalogAPI::Metadata.new(i) }
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CatalogAPI
4
+ class Metadata
5
+ attr_reader :key, :uri, :value
6
+ def initialize(opts)
7
+ @key = opts[:key]
8
+ @url = opts[:url]
9
+ @value = opts[:value]
10
+ end
11
+ end
12
+ end
@@ -5,7 +5,8 @@ module CatalogAPI
5
5
  attr_reader :date_placed, :external_user_id, :order_number,
6
6
  :external_order_number, :first_name, :last_name,
7
7
  :address_1, :address_2, :address_3, :city, :state_province,
8
- :postal_code, :country, :phone_number, :email, :items
8
+ :postal_code, :country, :phone_number, :email, :items,
9
+ :fulfillments
9
10
 
10
11
  def initialize(opts)
11
12
  @date_placed = nil
@@ -28,6 +29,7 @@ module CatalogAPI
28
29
  @country = opts[:country]
29
30
  @email = opts[:email]
30
31
  @phone_number = opts[:phone_number]
32
+ @fulfillments = opts[:fulfillments].to_a
31
33
  @items = opts[:items].to_a
32
34
  end
33
35
 
@@ -81,8 +83,9 @@ module CatalogAPI
81
83
 
82
84
  request = CatalogAPI.request.new(:order_track).get(order_number: order_number)
83
85
  json = request.json.dig(:order_track_response, :order_track_result, :order)
84
- items = json.dig(:items, :OrderItem).to_a.map { |i| CatalogAPI::Item.new(i) }
85
- request.data = CatalogAPI::Order.new(json.merge(items: items))
86
+ items = json.dig(:items, :OrderItem).to_a.map { |i| CatalogAPI::OrderItem.new(i) }
87
+ fulfillments = json.dig(:fulfillments, :Fulfillment).to_a.map { |i| CatalogAPI::Fulfillment.new(i) }
88
+ request.data = CatalogAPI::Order.new(json.merge(items: items, fulfillments: fulfillments))
86
89
  request
87
90
  end
88
91
 
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CatalogAPI
4
+ class OrderItem
5
+ attr_reader :catalog_item_id, :catalog_price, :currency, :metadata, :name,
6
+ :option, :order_item_id, :order_item_status,
7
+ :order_item_status_id, :points
8
+ def initialize(opts)
9
+ @catalog_item_id = opts[:catalog_item_id]
10
+ @catalog_price = opts[:catalog_price]
11
+ @currency = opts[:currency]
12
+ @metadata = opts.dig(:metadata, :Meta).to_a.map { |i| CatalogAPI::Metadata.new(i) }
13
+ @name = opts[:name]
14
+ @option = opts[:option]
15
+ @order_item_id = opts[:order_item_id]
16
+ @order_item_status = opts[:order_item_status]
17
+ @order_item_status_id = opts[:order_item_status_id]
18
+ @points = opts[:points]
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CatalogAPI
4
- VERSION = '0.1.0rc3'
4
+ VERSION = '0.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catalogapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0rc3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - davidrichey
@@ -45,8 +45,11 @@ files:
45
45
  - lib/catalogapi.rb
46
46
  - lib/catalogapi/catalog.rb
47
47
  - lib/catalogapi/category.rb
48
+ - lib/catalogapi/fulfillment.rb
48
49
  - lib/catalogapi/item.rb
50
+ - lib/catalogapi/metadata.rb
49
51
  - lib/catalogapi/order.rb
52
+ - lib/catalogapi/order_item.rb
50
53
  - lib/catalogapi/request.rb
51
54
  - lib/catalogapi/version.rb
52
55
  homepage: http://github.com/memberhubteam/catalogapi
@@ -67,9 +70,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
70
  version: 2.3.0
68
71
  required_rubygems_version: !ruby/object:Gem::Requirement
69
72
  requirements:
70
- - - ">"
73
+ - - ">="
71
74
  - !ruby/object:Gem::Version
72
- version: 1.3.1
75
+ version: '0'
73
76
  requirements: []
74
77
  rubygems_version: 3.0.3
75
78
  signing_key: