nurego 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +178 -25
  2. data/Rakefile +7 -2
  3. data/VERSION +1 -1
  4. data/lib/nurego/version.rb +1 -1
  5. metadata +2 -2
data/README.md CHANGED
@@ -1,25 +1,178 @@
1
- nurego-ruby
2
- ===========
3
-
4
- Ruby bindings for Nurego API
5
-
6
- == Installation
7
-
8
- You don't need this source code unless you want to modify the gem. If
9
- you just want to use the Nurego Ruby bindings, you should run:
10
-
11
- gem install nurego
12
-
13
- If you want to build the gem from source:
14
-
15
- gem build nurego.gemspec
16
-
17
- == Requirements
18
-
19
- * Ruby 1.8.7 or above.
20
-
21
- == Development
22
-
23
- Test cases can be run with: `bundle exec rake spec:unit`
24
-
25
- Examples can be run with: `bundle install; ruby -I./lib examples/<example_name>.rb`
1
+ <h3>Overview</h3><br>Nurego-Ruby is simple Ruby bindings library allows easy access to Nurego system, without any hassle of dealing with REST APIs and object mapping. Each object in the system has its own Ruby representation. There are relationships between some of them and they can be traversed using Nurego-Ruby API. The following objects can be used by the customers of Nurego-Ruby:<br><ul><li>Bill</li><li>Connector</li><li>Customer</li><li>Entitlement</li><li>Feature</li><li>Instance</li><li>Offering</li><li>Organization</li><li>Password Reset</li><li>Payment Method</li><li>Plan</li><li>Registration</li></ul>Some of the objects allow simple CRUD (or subset of it), when the others hide more complex operations like password reset. <br><br><h3>Initialization</h3>
2
+ <pre><span style="color:#400000; ">require</span> “nurego”
3
+ Nurego<span style="color:#308080; ">.</span>api_key <span style="color:#308080; ">=</span> “l230bc7b<span style="color:#308080; ">-</span>9b85<span style="color:#308080; ">-</span>4c5f<span style="color:#308080; ">-</span>ad9f<span style="color:#308080; ">-</span>4eeeef4d4f44”
4
+ </pre><br>Your API key can be obtained from Settings/Organization<br><h3>Authorization</h3><br>Some of the operations require customer login (TBD)<br><br><h3>Error handling</h3><br>Several errors can be thrown by the library. The base class for all Nurego errors is Nurego::NuregoError<br><br>Additional error that can be thrown by the library are:<br><br>Nurego::APIConnectionError - failed to connect to the Nurego API endpoing<br>Nurego::APIErrror - bad response from API endpoint<br>Nurego::CardError - invalid token was provided<br>Nurego::UserNotFoundError - user not found<br>Nurego::InvalidRequestError - the request to the API endpoint was bad or had wrong arguments<br>Nurego::AuthenticationError - bad API key or username/password was provided<br><h3><br>Entitlement</h3><br> To use an entitlement object you need to obtain customer external ID. In case of Stripe it will be Stripe customer ID (guid starting with cus_<br><br>Get entitlement for customer<br><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(0, 0, 0); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 19.600000381469727px; white-space: normal;"></span><span style="font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; color: rgb(32, 0, 128);">begin</span>
5
+ Nureg<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
6
+
7
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>login<span style="color: rgb(48, 128, 128);">(</span>username, password<span style="color: rgb(48, 128, 128);">)</span>
8
+
9
+ customer <span style="color: rgb(48, 128, 128);">=</span> Nurego::Customer<span style="color: rgb(48, 128, 128);">.</span>me
10
+ organization <span style="color: rgb(48, 128, 128);">=</span> customer<span style="color: rgb(48, 128, 128);">.</span>organizations<span style="color: rgb(48, 128, 128);">[</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(48, 128, 128);">]</span>
11
+ ents <span style="color: rgb(48, 128, 128);">=</span> organization<span style="color: rgb(48, 128, 128);">.</span>entitlements<span style="color: rgb(48, 128, 128);">(</span><span style="color: rgb(32, 0, 128); font-weight: bold;">nil</span>, customer_id<span style="color: rgb(48, 128, 128);">)</span>
12
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>&gt; e
13
+ <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
14
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(16, 96, 182);"></span><span style="font-family: monospace; font-size: 12px; font-style: normal; font-variant: normal; color: rgb(48, 128, 128);">[</span><span style="font-family: monospace; font-size: 12px; font-style: normal; font-variant: normal; color: rgb(89, 89, 121);">#&lt;Nurego::NuregoObject:0x18b83b8&gt; JSON: {</span><span style="color: rgb(16, 96, 182);">
15
+ "id"</span>: <span style="color: rgb(16, 96, 182);">"dba33a54-57dc-4a29-abf7-0a83aa7c1961"</span>,
16
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"entitlement"</span>,
17
+ <span style="color: rgb(16, 96, 182);">"feature_name"</span>: <span style="color: rgb(16, 96, 182);">"subscribers"</span>,
18
+ <span style="color: rgb(16, 96, 182);">"max_allowed_amount"</span>: <span style="color: rgb(0, 140, 0);">10</span>
19
+ }<span style="color: rgb(48, 128, 128);">]</span></pre><br>Get entitlements for customer and feature<br><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(32, 0, 128); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">begin</span>
20
+ Nureg<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
21
+
22
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>login<span style="color: rgb(48, 128, 128);">(</span>username, password<span style="color: rgb(48, 128, 128);">)</span>
23
+
24
+ customer <span style="color: rgb(48, 128, 128);">=</span> Nurego::Customer<span style="color: rgb(48, 128, 128);">.</span>me
25
+ organization <span style="color: rgb(48, 128, 128);">=</span> customer<span style="color: rgb(48, 128, 128);">.</span>organizations<span style="color: rgb(48, 128, 128);">[</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(48, 128, 128);">]</span>
26
+ ents <span style="color: rgb(48, 128, 128);">=</span> organization<span style="color: rgb(48, 128, 128);">.</span>entitlements<span style="color: rgb(48, 128, 128);">(</span>feature_id, customer_id<span style="color: rgb(48, 128, 128);">)</span>
27
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>&gt; e
28
+ <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
29
+
30
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><br>Submit usage for customer<br><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(32, 0, 128); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">begin</span>
31
+ Nureg<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
32
+
33
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>login<span style="color: rgb(48, 128, 128);">(</span>username, password<span style="color: rgb(48, 128, 128);">)</span>
34
+
35
+ ent <span style="color: rgb(48, 128, 128);">=</span> Nurego::Entitlement<span style="color: rgb(48, 128, 128);">.</span><span style="color: rgb(32, 0, 128); font-weight: bold;">new</span><span style="color: rgb(48, 128, 128);">(</span><span style="color: rgb(64, 96, 128);">{</span>id: customer_id<span style="color: rgb(64, 96, 128);">}</span><span style="color: rgb(48, 128, 128);">)</span>
36
+ ent<span style="color: rgb(48, 128, 128);">.</span>set_usage<span style="color: rgb(48, 128, 128);">(</span>feature_id, max_amount <span style="color: rgb(48, 128, 128);">-</span> <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(48, 128, 128);">)</span>
37
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>&gt; e
38
+ <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
39
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><br>Check allowed usage for customer<br><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(0, 0, 0); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 19.600000381469727px; white-space: normal;"></span><span style="font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; color: rgb(32, 0, 128);">begin</span>
40
+ Nureg<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
41
+
42
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>login<span style="color: rgb(48, 128, 128);">(</span>username, password<span style="color: rgb(48, 128, 128);">)</span>
43
+
44
+ customer <span style="color: rgb(48, 128, 128);">=</span> Nurego::Customer<span style="color: rgb(48, 128, 128);">.</span>me
45
+ organization <span style="color: rgb(48, 128, 128);">=</span> customer<span style="color: rgb(48, 128, 128);">.</span>organizations<span style="color: rgb(48, 128, 128);">[</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(48, 128, 128);">]</span>
46
+ ents <span style="color: rgb(48, 128, 128);">=</span> organization<span style="color: rgb(48, 128, 128);">.</span>entitlements<span style="color: rgb(48, 128, 128);">(</span>feature_id, customer_id<span style="color: rgb(48, 128, 128);">)</span>
47
+ ent <span style="color: rgb(48, 128, 128);">=</span> ents<span style="color: rgb(48, 128, 128);">[</span><span style="color: rgb(0, 140, 0);">0</span><span style="color: rgb(48, 128, 128);">]</span>
48
+
49
+
50
+ allowed <span style="color: rgb(48, 128, 128);">=</span> ent<span style="color: rgb(48, 128, 128);">.</span>is_allowed<span style="color: rgb(48, 128, 128);">(</span>feature_id, <span style="color: rgb(0, 140, 0);">1</span><span style="color: rgb(48, 128, 128);">)</span>
51
+ <span style="color: rgb(64, 0, 0);">puts</span> <span style="color: rgb(16, 96, 182);">"#{allowed.inspect}"</span>
52
+
53
+ allowed <span style="color: rgb(48, 128, 128);">=</span> ent<span style="color: rgb(48, 128, 128);">.</span>is_allowed<span style="color: rgb(48, 128, 128);">(</span>feature_id, <span style="color: rgb(0, 140, 0);">2</span><span style="color: rgb(48, 128, 128);">)</span>
54
+ <span style="color: rgb(64, 0, 0);">puts</span> <span style="color: rgb(16, 96, 182);">"#{allowed.inspect}"</span>
55
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>&gt; e
56
+ <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
57
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><h3>Feature</h3><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(32, 0, 128); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">begin</span>
58
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
59
+ offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current
60
+ offering<span style="color: rgb(48, 128, 128);">.</span>plans<span style="color: rgb(48, 128, 128);">.</span><span style="color: rgb(32, 0, 128); font-weight: bold;">each</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">do</span> |plan|
61
+ <span style="color: rgb(64, 0, 0);">puts</span> plan<span style="color: rgb(48, 128, 128);">.</span>inspect
62
+ plan<span style="color: rgb(48, 128, 128);">.</span>features<span style="color: rgb(48, 128, 128);">.</span><span style="color: rgb(32, 0, 128); font-weight: bold;">each</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">do</span> |feature|
63
+ <span style="color: rgb(64, 0, 0);">puts</span> feature<span style="color: rgb(48, 128, 128);">.</span>inspect
64
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>
65
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><br>Response will look like this<br><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(89, 89, 121); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">#&lt;Nurego::Feature:0x1285518&gt; JSON: {</span>
66
+ <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
67
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
68
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Funds Service"</span>,
69
+ <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
70
+ <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 128, 0);">0.0</span>,
71
+ <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
72
+ <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
73
+ <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
74
+ <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
75
+ <span style="color: rgb(16, 96, 182);">"unit_type"</span>: <span style="color: rgb(64, 96, 128);">{</span><span style="color: rgb(16, 96, 182);">"name"</span>:<span style="color: rgb(16, 96, 182);">"Funds Service"</span>,<span style="color: rgb(16, 96, 182);">"consumable"</span>:<span style="color: rgb(32, 0, 128); font-weight: bold;">false</span>,<span style="color: rgb(16, 96, 182);">"apply_repetition"</span>:<span style="color: rgb(0, 140, 0);">0</span>,<span style="color: rgb(16, 96, 182);">"guid"</span>:<span style="color: rgb(16, 96, 182);">"cd96f327-e1e1-4081-8717-a5baaae4984e"</span><span style="color: rgb(64, 96, 128);">}</span>
76
+ }</pre><h3>Offering</h3>Retrieve the current offering for the 'All' segment through the 'website' distribution channel.<pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(32, 0, 128); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">begin</span>
77
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
78
+ offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current
79
+ <span style="color: rgb(64, 0, 0);"> puts</span> offering<span style="color: rgb(48, 128, 128);">.</span>inspect
80
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><br>To retrieve offerings available for a particular segment and/or distribution channel, add the optional ```:segment_guid``` and/or ```:distribution_channel``` parameters. To learn more about segments and distribution channels, take a look at the [documentation](http://nurego.com/documentation) <pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(32, 0, 128); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">begin</span>
81
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
82
+ offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current({:segment_guid => '```<SEGMENT>```', :distribution_channel => '```<CHANNEL>```'})
83
+ <span style="color: rgb(64, 0, 0);"> puts</span> offering<span style="color: rgb(48, 128, 128);">.</span>inspect
84
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><span style="font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 19.600000381469727px;">Response will look like this</span><br><pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(16, 96, 182);"></span><span style="color: rgb(89, 89, 121); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">#&lt;Nurego::ListObject:0x1412db8&gt; JSON: {</span><span style="color: rgb(16, 96, 182);">
85
+ "data"</span>: <span style="color: rgb(48, 128, 128);">[</span>
86
+ <span style="color: rgb(64, 96, 128);">{</span>
87
+ <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"ce24d45f-4b33-41d3-a3cb-d46ad411c086"</span>,
88
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"plan"</span>,
89
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Entry Level"</span>,
90
+ <span style="color: rgb(16, 96, 182);">"description"</span>: null,
91
+ <span style="color: rgb(16, 96, 182);">"plan_status"</span>: <span style="color: rgb(16, 96, 182);">"active"</span>,
92
+ <span style="color: rgb(16, 96, 182);">"credit_card"</span>: <span style="color: rgb(32, 0, 128); font-weight: bold;">false</span>,
93
+ <span style="color: rgb(16, 96, 182);">"plan_order"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
94
+ <span style="color: rgb(16, 96, 182);">"discounts"</span>: <span style="color: rgb(48, 128, 128);">[</span>
95
+
96
+ <span style="color: rgb(48, 128, 128);">]</span>,
97
+ <span style="color: rgb(16, 96, 182);">"features"</span>: <span style="color: rgb(64, 96, 128);">{</span>
98
+ <span style="color: rgb(16, 96, 182);">"data"</span>: <span style="color: rgb(48, 128, 128);">[</span>
99
+ <span style="color: rgb(64, 96, 128);">{</span>
100
+ <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
101
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
102
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Email Support"</span>,
103
+ <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
104
+ <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
105
+ <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
106
+ <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
107
+ <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
108
+ <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
109
+ <span style="color: rgb(16, 96, 182);">"unit_type"</span>: <span style="color: rgb(64, 96, 128);">{</span>
110
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Email Support"</span>,
111
+ <span style="color: rgb(16, 96, 182);">"consumable"</span>: <span style="color: rgb(32, 0, 128); font-weight: bold;">false</span>,
112
+ <span style="color: rgb(16, 96, 182);">"apply_repetition"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
113
+ <span style="color: rgb(16, 96, 182);">"guid"</span>: <span style="color: rgb(16, 96, 182);">"dba33a54-57dc-4a29-abf7-0a83aa7c1961"</span>
114
+ <span style="color: rgb(64, 96, 128);">}</span>
115
+ <span style="color: rgb(64, 96, 128);">}</span>,
116
+ <span style="color: rgb(64, 96, 128);">{</span>
117
+ <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
118
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
119
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Financial News Service"</span>,
120
+ <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
121
+ <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
122
+ <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
123
+ <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
124
+ <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
125
+ <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
126
+ <span style="color: rgb(16, 96, 182);">"unit_type"</span>: <span style="color: rgb(64, 96, 128);">{</span>
127
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Financial News Service"</span>,
128
+ <span style="color: rgb(16, 96, 182);">"consumable"</span>: <span style="color: rgb(32, 0, 128); font-weight: bold;">false</span>,
129
+ <span style="color: rgb(16, 96, 182);">"apply_repetition"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
130
+ <span style="color: rgb(16, 96, 182);">"guid"</span>: <span style="color: rgb(16, 96, 182);">"7de73a31-db39-4aa7-a8c2-8c1d325ec080"</span>
131
+ <span style="color: rgb(64, 96, 128);">}</span>
132
+ <span style="color: rgb(64, 96, 128);">}</span>,
133
+ <span style="color: rgb(64, 96, 128);">{</span>
134
+ <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
135
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
136
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Indices Services"</span>,
137
+ <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
138
+ <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
139
+ <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
140
+ <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">2</span>,
141
+ <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
142
+ <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
143
+ <span style="color: rgb(16, 96, 182);">"unit_type"</span>: <span style="color: rgb(64, 96, 128);">{</span>
144
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Indices Services"</span>,
145
+ <span style="color: rgb(16, 96, 182);">"consumable"</span>: <span style="color: rgb(32, 0, 128); font-weight: bold;">false</span>,
146
+ <span style="color: rgb(16, 96, 182);">"apply_repetition"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
147
+ <span style="color: rgb(16, 96, 182);">"guid"</span>: <span style="color: rgb(16, 96, 182);">"65531b5f-a1af-474e-8709-65f49b6c6ad8"</span>
148
+ <span style="color: rgb(64, 96, 128);">}</span>
149
+ <span style="color: rgb(64, 96, 128);">}</span>,
150
+ <span style="color: rgb(64, 96, 128);">{</span>
151
+ <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
152
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
153
+ <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"recurring"</span>,
154
+ <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"recurring"</span>,
155
+ <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
156
+ <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
157
+ <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
158
+ <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
159
+ <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>
160
+ <span style="color: rgb(64, 96, 128);">}</span>
161
+ <span style="color: rgb(48, 128, 128);">]</span>,
162
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"list"</span>,
163
+ <span style="color: rgb(16, 96, 182);">"count"</span>: <span style="color: rgb(0, 140, 0);">4</span>,
164
+ <span style="color: rgb(16, 96, 182);">"url"</span>: <span style="color: rgb(16, 96, 182);">"\/v1\/plans\/ce24d45f-4b33-41d3-a3cb-d46ad411c086\/features"</span>
165
+ <span style="color: rgb(64, 96, 128);">}</span>
166
+ <span style="color: rgb(64, 96, 128);">}</span>
167
+ <span style="color: rgb(48, 128, 128);">]</span>,
168
+ <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"list"</span>,
169
+ <span style="color: rgb(16, 96, 182);">"count"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
170
+ <span style="color: rgb(16, 96, 182);">"url"</span>: <span style="color: rgb(16, 96, 182);">"/v1/offerings/013ddd26-131d-43f9-95e3-790111a91dad/plans"</span>
171
+ }</pre><h3>Plan</h3>The ```:distribution_channel``` and ```:segment_guid``` params are optional. Use them to call plans for a specific distribution channel and/or segment. To learn more about creating segments and distribution channels, check out the [documentation](http://nurego.com/documentation)<pre style="color: rgb(0, 0, 32); font-size: medium; font-style: normal; font-variant: normal; line-height: normal;"><span style="color: rgb(32, 0, 128); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">begin</span>
172
+ Nurego<span style="color: rgb(48, 128, 128);">.</span>api_key <span style="color: rgb(48, 128, 128);">=</span> “l230bc7b<span style="color: rgb(48, 128, 128);">-</span>9b85<span style="color: rgb(48, 128, 128);">-</span>4c5f<span style="color: rgb(48, 128, 128);">-</span>ad9f<span style="color: rgb(48, 128, 128);">-</span>4eeeef4d4f44”
173
+ offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current({:segment_guid => '```<SEGMENT>```', :distribution_channel => '```<CHANNEL>```'})
174
+
175
+ offering<span style="color: rgb(48, 128, 128);">.</span>plans<span style="color: rgb(48, 128, 128);">.</span><span style="color: rgb(32, 0, 128); font-weight: bold;">each</span> <span style="color: rgb(32, 0, 128); font-weight: bold;">do</span> |plan|
176
+ <span style="color: rgb(64, 0, 0);">puts</span> plan<span style="color: rgb(48, 128, 128);">.</span>inspect
177
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>
178
+ <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span></pre><div></div>
data/Rakefile CHANGED
@@ -24,8 +24,13 @@ namespace "spec" do
24
24
  FileUtils.rm_rf File.join('.', "coverage")
25
25
 
26
26
  SimpleCov.start do
27
- formatter SimpleCov::Formatter::CSVFormatter
28
- coverage_dir ENV["COVERAGE_REPORTS"]
27
+ if ENV["FORMAT"] == "csv"
28
+ SimpleCov.formatter = SimpleCov::Formatter::CSVFormatter
29
+ else
30
+ SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
31
+ end
32
+
33
+ SimpleCov.coverage_dir(ENV["COVERAGE_REPORTS"])
29
34
  root '.'
30
35
 
31
36
  add_filter "/spec/"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -1,3 +1,3 @@
1
1
  module Nurego
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nurego
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-20 00:00:00.000000000 Z
12
+ date: 2014-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client