flowlink_data 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/flowlink_data/objectbase.rb +24 -0
- data/lib/flowlink_data/product.rb +97 -0
- data/lib/flowlink_data/version.rb +3 -0
- data/lib/flowlink_data.rb +2 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f30e9032e58c11bbe78ab0f7affc92e13856132e
|
4
|
+
data.tar.gz: 2b1f6525c5558b91ceca3d029511ae15b18a5da8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ddadf3388738b8ffc79611bc063ddfefeba4167ea3aefb2805fc6440116601e309baa4eace7d12ab0ab01b450113f89fb71ca4588c4f9337302237221db1467c
|
7
|
+
data.tar.gz: b6239e0bb6c06f440ed238ad331a452dc01f9bf674b765bd41773459eab99ec491f8df7ad3b0ce371e09445d8edc0e64bcd4cc60c4f66eec21deec0637c2d5a4
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Flowlink
|
2
|
+
class ObjectBase
|
3
|
+
# Base class for any Flowlink objects. Child classes should implement
|
4
|
+
# self.fields internally.
|
5
|
+
|
6
|
+
def to_hash
|
7
|
+
# Put values of calling field methods on self into a hash
|
8
|
+
Hash[fields.map { |f| [f.to_s, send(f)] }]
|
9
|
+
end
|
10
|
+
|
11
|
+
alias to_message to_hash
|
12
|
+
|
13
|
+
def self.fields
|
14
|
+
# A list of fields that the object should have.
|
15
|
+
raise NotImplementedError
|
16
|
+
end
|
17
|
+
|
18
|
+
def fields
|
19
|
+
self.class.fields
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'flowlink_data/objectbase'
|
2
|
+
|
3
|
+
module Flowlink
|
4
|
+
class Product < ObjectBase
|
5
|
+
# This is an abstract class defining the standard product fields for
|
6
|
+
# Flowlink (and Wombat) as methods. It's intended use is as a super class
|
7
|
+
# for a specific distributor, where the methods take a hashable and return
|
8
|
+
# the value matching their namesake. These fields and their values are
|
9
|
+
# described here:
|
10
|
+
# https://support.wombat.co/hc/en-us/articles/202555810-Products
|
11
|
+
|
12
|
+
def self.fields
|
13
|
+
[
|
14
|
+
:id,
|
15
|
+
:name,
|
16
|
+
:sku,
|
17
|
+
:description,
|
18
|
+
:price,
|
19
|
+
:cost_price,
|
20
|
+
:available_on,
|
21
|
+
:permalink,
|
22
|
+
:meta_description,
|
23
|
+
:meta_keywords,
|
24
|
+
:shipping_category,
|
25
|
+
:taxons,
|
26
|
+
:options,
|
27
|
+
:properties,
|
28
|
+
:images,
|
29
|
+
:variants
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def id
|
34
|
+
raise NotImplementedError
|
35
|
+
end
|
36
|
+
|
37
|
+
def name
|
38
|
+
raise NotImplementedError
|
39
|
+
end
|
40
|
+
|
41
|
+
def sku
|
42
|
+
raise NotImplementedError
|
43
|
+
end
|
44
|
+
|
45
|
+
def description
|
46
|
+
raise NotImplementedError
|
47
|
+
end
|
48
|
+
|
49
|
+
def price
|
50
|
+
raise NotImplementedError
|
51
|
+
end
|
52
|
+
|
53
|
+
def cost_price
|
54
|
+
raise NotImplementedError
|
55
|
+
end
|
56
|
+
|
57
|
+
def available_on
|
58
|
+
raise NotImplementedError
|
59
|
+
end
|
60
|
+
|
61
|
+
def permalink
|
62
|
+
raise NotImplementedError
|
63
|
+
end
|
64
|
+
|
65
|
+
def meta_description
|
66
|
+
raise NotImplementedError
|
67
|
+
end
|
68
|
+
|
69
|
+
def meta_keywords
|
70
|
+
raise NotImplementedError
|
71
|
+
end
|
72
|
+
|
73
|
+
def shipping_category
|
74
|
+
raise NotImplementedError
|
75
|
+
end
|
76
|
+
|
77
|
+
def taxons
|
78
|
+
raise NotImplementedError
|
79
|
+
end
|
80
|
+
|
81
|
+
def options
|
82
|
+
raise NotImplementedError
|
83
|
+
end
|
84
|
+
|
85
|
+
def properties
|
86
|
+
raise NotImplementedError
|
87
|
+
end
|
88
|
+
|
89
|
+
def images
|
90
|
+
raise NotImplementedError
|
91
|
+
end
|
92
|
+
|
93
|
+
def variants
|
94
|
+
raise NotImplementedError
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flowlink_data
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cooper LeBrun
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |-
|
14
|
+
A framework for getting Flowlink objects from other sources. For example:
|
15
|
+
class Distributor::Product < Flowlink::Product
|
16
|
+
def sku(hashable)
|
17
|
+
# code that picks sku data out of a hashable object.
|
18
|
+
end
|
19
|
+
end
|
20
|
+
Distributor::Product.new(CSV::Row).to_message #=> A bunch of NotImplementedError because just a sku is an invalid product
|
21
|
+
email:
|
22
|
+
- cooperlebrun@gmail.com
|
23
|
+
executables: []
|
24
|
+
extensions: []
|
25
|
+
extra_rdoc_files: []
|
26
|
+
files:
|
27
|
+
- lib/flowlink_data.rb
|
28
|
+
- lib/flowlink_data/objectbase.rb
|
29
|
+
- lib/flowlink_data/product.rb
|
30
|
+
- lib/flowlink_data/version.rb
|
31
|
+
homepage: https://github.com/aokpower/flowlink_data
|
32
|
+
licenses:
|
33
|
+
- MIT
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 2.5.1
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: A simple framework for getting Flowlink objects from other sources.
|
55
|
+
test_files: []
|
56
|
+
has_rdoc:
|