gotransverse-tract-api 0.0.3 → 0.0.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
  SHA1:
3
- metadata.gz: f70a7d9a3a21595b24955cc8706dc35566287133
4
- data.tar.gz: 72da6f479cca644c88229f5fe636d79ac96bd32a
3
+ metadata.gz: abe8d19384301bd7663cb312e9cda29e2335b0f5
4
+ data.tar.gz: 784e54101184228e29cba4f3bd1285e9a2e8b4a7
5
5
  SHA512:
6
- metadata.gz: 948d261f7b79020531c76c3bd569a0a9320f0d8ca2b31f6746b04d3e5d229271da4bff842100e089febd10d4e9507ab96eb465ab28ce36ea163989bc7e757cba
7
- data.tar.gz: e9fe8a3f9e564f7e2979bd258fe9f5dab67790aa9e22b98e1e2dbfd71f4b617361927fa2f64d715243e63c8901c959f4130eb9ccd426b69eccf63d0b9c50ea69
6
+ metadata.gz: b83013ea5c8414ac68fa15df2a4e6268b579a2a5d46fbf7d07e39ce6b126794dc58dc3407bf868a1d51a0bc0151c08cbd0621334373b93780c473a42670c222b
7
+ data.tar.gz: 11ad087f4da2132796056ffcaf2cbff7680a28d8fffb11deb860914b5741604611dd1ac007e500440ed45d2fa200a0b5be289ce117220caf831edd7db7de3b7d
@@ -98,15 +98,17 @@ module GoTransverseTractApi
98
98
  end
99
99
 
100
100
  #
101
- # self.get_response_from
101
+ # self.get_response_for
102
102
  #
103
- # @param {String} api_url
103
+ # @param {Class} klass
104
104
  # @param {Hash} api_params
105
105
  #
106
- def self.get_response_from(api_url, api_params)
106
+ def self.get_response_for(klass, api_params)
107
+
108
+ api_url = GoTransverseTractApi.get_api_url_for(klass)
107
109
 
108
110
  if GoTransverseTractApi.configuration.cache_enabled
109
- return self.get_cached_response_from(api_url, api_params)
111
+ return self.get_cached_response_from(klass, api_params)
110
112
  end
111
113
 
112
114
  # Unless cached
@@ -114,22 +116,24 @@ module GoTransverseTractApi
114
116
  end
115
117
 
116
118
  #
117
- # self.post_request_to
119
+ # self.post_request_for
118
120
  #
119
- # @param {String} api_url
121
+ # @param {Class} klass
120
122
  # @param {Hash} api_params
121
123
  #
122
- def self.post_request_to(api_url, api_params)
124
+ def self.post_request_for(klass, api_params)
125
+ api_url = GoTransverseTractApi.get_api_url_for(klass)
123
126
  self.call(api_url, api_params, :post)
124
127
  end
125
128
 
126
129
  #
127
- # self.put_request_to
130
+ # self.put_request_for
128
131
  #
129
- # @param {String} api_url
132
+ # @param {Class} klass
130
133
  # @param {Hash} api_params
131
134
  #
132
- def self.put_request_to(api_url, api_params)
135
+ def self.put_request_for(klass, api_params)
136
+ api_url = GoTransverseTractApi.get_api_url_for(klass)
133
137
  self.call(api_url, api_params, :put)
134
138
  end
135
139
 
@@ -143,19 +147,19 @@ module GoTransverseTractApi
143
147
  end
144
148
 
145
149
  #
146
- # self.get_cached_response_from
150
+ # self.get_cached_response_for
147
151
  #
148
- # @param {String} api_url
152
+ # @param {Class} klass
149
153
  # @param {Hash} api_params
150
154
  #
151
- def self.get_cached_response_from(api_url, api_params)
152
- key = "#{api_url}.#{api_params.sort}"
155
+ def self.get_cached_response_for(klass, api_params)
156
+ key = "#{klass.classname}.#{api_params.sort}"
153
157
 
154
158
  return Rails.cache.fetch(key, expires_in: 10.minutes) do
155
- self.get_response_from(api_url, api_params)
159
+ self.get_response_from(klass, api_params)
156
160
  end
157
161
 
158
- return self.get_response_from(api_url, api_params)
162
+ return self.get_response_from(klass, api_params)
159
163
  end
160
164
 
161
165
  #
@@ -4,8 +4,86 @@ module GoTransverseTractApi
4
4
 
5
5
  class Product
6
6
 
7
+ #
8
+ # @param {Long} eid
9
+ #
10
+ def self.find_by_eid eid
11
+ GoTransverseTractApi.get_response_for(self.class, {eid: eid})
12
+ end
13
+
14
+ #
15
+ # @param {String} name
16
+ #
17
+ def self.find_by_name name
18
+ GoTransverseTractApi.get_response_for(self.class, {name: name})
19
+ end
20
+
21
+ #
22
+ # @param {String} internal_name
23
+ #
24
+ def self.find_by_internal_name internal_name
25
+ GoTransverseTractApi.get_response_for(self.class, {internal_name: internal_name})
26
+ end
27
+
28
+ #
29
+ # @param {String} external_product_number
30
+ #
31
+ def self.find_by_external_product_number external_product_number
32
+ GoTransverseTractApi.get_response_for(self.class, {external_product_number: external_product_number})
33
+ end
34
+
35
+ #
36
+ # @param {String} sku
37
+ #
38
+ def self.find_by_sku sku
39
+ GoTransverseTractApi.get_response_for(self.class, {sku: sku})
40
+ end
41
+
42
+ #
43
+ # @param {String} product_type_code
44
+ #
45
+ def self.find_by_product_type_code product_type_code
46
+ GoTransverseTractApi.get_response_for(self.class, {product_type_code: product_type_code})
47
+ end
48
+
49
+ #
50
+ # @param {String} product_state
51
+ #
52
+ def self.find_by_product_state product_state
53
+ GoTransverseTractApi.get_response_for(self.class, {product_state: product_state})
54
+ end
55
+
56
+ #
57
+ # @param {Long} service_resource_category_eid
58
+ #
59
+ def self.find_by_service_resource_category_eid service_resource_category_eid
60
+ GoTransverseTractApi.get_response_for(self.class, {service_resource_category_eid: service_resource_category_eid})
61
+ end
62
+
63
+ #
64
+ # @param {String} service_resource_category_name
65
+ #
66
+ def self.find_by_service_resource_category_name service_resource_category_name
67
+ GoTransverseTractApi.get_response_for(self.class, {service_resource_category_name: service_resource_category_name})
68
+ end
69
+
70
+ #
71
+ # @param {Long} product_category_eid
72
+ #
73
+ def self.find_by_product_category_eid product_category_eid
74
+ GoTransverseTractApi.get_response_for(self.class, {product_category_eid: product_category_eid})
75
+ end
76
+
77
+ #
78
+ # @param {Boolean} price_list_is_master
79
+ #
80
+ def self.find_by_price_list_is_master price_list_is_master
81
+ GoTransverseTractApi.get_response_for(self.class, {price_list_is_master: price_list_is_master})
82
+ end
83
+
7
84
  end
8
85
 
9
86
  end
10
87
 
11
- end
88
+ end
89
+
@@ -1,6 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  TARGET_API_VERSION = "1.19"
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotransverse-tract-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien DeFrance