megam_api 0.52 → 0.53
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.
- checksums.yaml +4 -4
- data/lib/megam/api/discounts.rb +13 -0
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/assembly.rb +1 -1
- data/lib/megam/core/components.rb +1 -1
- data/lib/megam/core/discounts.rb +17 -3
- data/lib/megam/core/promos.rb +2 -1
- data/test/test_helper.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca9e626deed7bb1c3e51603cdf3ba8e942b1fff
|
4
|
+
data.tar.gz: 23da3d313850bdc4d822a9d372127af1b5d78b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7d9ecb822284bdeb76f9a888eca90968cdb6c97e3b2d2269c9250346a69b516c66a6ff34553f118f1711d6adf688da704d94b6ae2f68708ba3a5272148de25
|
7
|
+
data.tar.gz: 0009747a1d0b5abef1febe1687d7c7b8dc0f7216c41eb6fffaae0ce9c871b913e7e5778976398cf96cdfa44c5b594cb96631bdd909e76af4c915e9cc6d55b368
|
data/lib/megam/api/discounts.rb
CHANGED
@@ -30,6 +30,19 @@ module Megam
|
|
30
30
|
:body => @options[:body]
|
31
31
|
)
|
32
32
|
end
|
33
|
+
|
34
|
+
|
35
|
+
def update_discounts(update_discount)
|
36
|
+
@options = {:path => '/discounts/update',
|
37
|
+
:body => Megam::JSONCompat.to_json(update_discount)}.merge(@options)
|
38
|
+
|
39
|
+
request(
|
40
|
+
:expects => 201,
|
41
|
+
:method => :post,
|
42
|
+
:body => @options[:body]
|
43
|
+
)
|
44
|
+
|
45
|
+
end
|
33
46
|
|
34
47
|
end
|
35
48
|
end
|
data/lib/megam/api/version.rb
CHANGED
data/lib/megam/core/assembly.rb
CHANGED
data/lib/megam/core/discounts.rb
CHANGED
@@ -158,15 +158,29 @@ module Megam
|
|
158
158
|
self
|
159
159
|
end
|
160
160
|
|
161
|
-
def self.create(
|
162
|
-
|
163
|
-
|
161
|
+
def self.create(params)
|
162
|
+
puts "creating discounts entry...hold tight"
|
163
|
+
puts params.inspect
|
164
|
+
discount = from_hash(params)
|
165
|
+
discount.create
|
164
166
|
end
|
165
167
|
|
166
168
|
# Create the discounts via the REST API
|
167
169
|
def create
|
170
|
+
puts "YES. CREATING....JUST A SEC"
|
171
|
+
puts to_hash
|
168
172
|
megam_rest.post_discounts(to_hash)
|
169
173
|
end
|
174
|
+
|
175
|
+
def self.update(o)
|
176
|
+
discount = from_hash(o)
|
177
|
+
discount.update
|
178
|
+
end
|
179
|
+
|
180
|
+
# Create the node via the REST API
|
181
|
+
def update
|
182
|
+
megam_rest.update_discounts(to_hash)
|
183
|
+
end
|
170
184
|
|
171
185
|
# Load all discounts -
|
172
186
|
# returns a discountsCollection
|
data/lib/megam/core/promos.rb
CHANGED
@@ -147,8 +147,9 @@ module Megam
|
|
147
147
|
# Show a particular promo by name,
|
148
148
|
# Megam::Promos
|
149
149
|
def self.show(params)
|
150
|
+
puts "[x] Called show"
|
150
151
|
pre = self.new(params["email"], params["api_key"])
|
151
|
-
pre.megam_rest.get_promos(params["
|
152
|
+
pre.megam_rest.get_promos(params["code"])
|
152
153
|
end
|
153
154
|
|
154
155
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megam_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.53'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|