Overview


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:
  • Bill
  • Connector
  • Customer
  • Entitlement
  • Feature
  • Instance
  • Offering
  • Organization
  • Password Reset
  • Payment Method
  • Plan
  • Registration
Some of the objects allow simple CRUD (or subset of it), when the others hide more complex operations like password reset.

Initialization

<span style="color:#400000; ">require</span> “nurego”
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”

Your API key can be obtained from Settings/Organization

Authorization


Some of the operations require customer login (TBD)

Error handling


Several errors can be thrown by the library. The base class for all Nurego errors is Nurego::NuregoError

Additional error that can be thrown by the library are:

Nurego::APIConnectionError - failed to connect to the Nurego API endpoing
Nurego::APIErrror - bad response from API endpoint
Nurego::CardError - invalid token was provided
Nurego::UserNotFoundError - user not found
Nurego::InvalidRequestError - the request to the API endpoint was bad or had wrong arguments
Nurego::AuthenticationError - bad API key or username/password was provided


Entitlement


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_

Get entitlement for customer
<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>
  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”</p>

<p>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></p>

<p>customer <span style="color: rgb(48, 128, 128);">=</span> Nurego::Customer<span style="color: rgb(48, 128, 128);">.</span>me
  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>
  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>
<span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>> e
  <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>
<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);">#<Nurego::NuregoObject:0x18b83b8> JSON: {</span><span style="color: rgb(16, 96, 182);">
 "id"</span>: <span style="color: rgb(16, 96, 182);">"dba33a54-57dc-4a29-abf7-0a83aa7c1961"</span>,
 <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"entitlement"</span>,
 <span style="color: rgb(16, 96, 182);">"feature_name"</span>: <span style="color: rgb(16, 96, 182);">"subscribers"</span>,
 <span style="color: rgb(16, 96, 182);">"max_allowed_amount"</span>: <span style="color: rgb(0, 140, 0);">10</span>
}<span style="color: rgb(48, 128, 128);">]</span>

Get entitlements for customer and feature
<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>
  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”</p>

<p>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></p>

<p>customer <span style="color: rgb(48, 128, 128);">=</span> Nurego::Customer<span style="color: rgb(48, 128, 128);">.</span>me
  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>
  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>
<span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>> e
  <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span></p>

<p><span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>

Submit usage for customer
<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>
  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”</p>

<p>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></p>

<p>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>
  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>
<span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>> e
  <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>

Check allowed usage for customer
<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>
  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”</p>

<p>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></p>

<p>customer <span style="color: rgb(48, 128, 128);">=</span> Nurego::Customer<span style="color: rgb(48, 128, 128);">.</span>me
  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>
  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>
  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></p>

<p>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>
  <span style="color: rgb(64, 0, 0);">puts</span> <span style="color: rgb(16, 96, 182);">"#{allowed.inspect}"</span></p>

<p>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>
  <span style="color: rgb(64, 0, 0);">puts</span> <span style="color: rgb(16, 96, 182);">"#{allowed.inspect}"</span>
<span style="color: rgb(32, 0, 128); font-weight: bold;">rescue</span> Nurego::NuregoError <span style="color: rgb(48, 128, 128);">=</span>> e
  <span style="color: rgb(64, 0, 0);">puts</span> “Got exception <span style="color: rgb(89, 89, 121);">#{e}”</span>
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>

Feature

<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>
  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”
  offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current
  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|
  <span style="color: rgb(64, 0, 0);">puts</span> plan<span style="color: rgb(48, 128, 128);">.</span>inspect
  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|
    <span style="color: rgb(64, 0, 0);">puts</span> feature<span style="color: rgb(48, 128, 128);">.</span>inspect
  <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>

Response will look like this
<span style="color: rgb(89, 89, 121); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant: normal; line-height: 14px;">#<Nurego::Feature:0x1285518> JSON: {</span>
 <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
  <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</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);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
  <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 128, 0);">0.0</span>,
  <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
  <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
  <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
  <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
  <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>
}

Offering

Retrieve the current offering for the 'All' segment through the 'website' distribution channel.
<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>
  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”
  offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current
<span style="color: rgb(64, 0, 0);">  puts</span> offering<span style="color: rgb(48, 128, 128);">.</span>inspect
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>

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
<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>
  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”
  offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current({:segment_guid => '<code><SEGMENT></code>', :distribution_channel => '<code><CHANNEL></code>'})
<span style="color: rgb(64, 0, 0);">  puts</span> offering<span style="color: rgb(48, 128, 128);">.</span>inspect
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>
Response will look like this
<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;">#<Nurego::ListObject:0x1412db8> JSON: {</span><span style="color: rgb(16, 96, 182);">
"data"</span>: <span style="color: rgb(48, 128, 128);">[</span>
<span style="color: rgb(64, 96, 128);">{</span>
  <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"ce24d45f-4b33-41d3-a3cb-d46ad411c086"</span>,
  <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"plan"</span>,
  <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Entry Level"</span>,
  <span style="color: rgb(16, 96, 182);">"description"</span>: null,
  <span style="color: rgb(16, 96, 182);">"plan_status"</span>: <span style="color: rgb(16, 96, 182);">"active"</span>,
  <span style="color: rgb(16, 96, 182);">"credit_card"</span>: <span style="color: rgb(32, 0, 128); font-weight: bold;">false</span>,
  <span style="color: rgb(16, 96, 182);">"plan_order"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
  <span style="color: rgb(16, 96, 182);">"discounts"</span>: <span style="color: rgb(48, 128, 128);">[</span></p>

<p><span style="color: rgb(48, 128, 128);">]</span>,
  <span style="color: rgb(16, 96, 182);">"features"</span>: <span style="color: rgb(64, 96, 128);">{</span>
    <span style="color: rgb(16, 96, 182);">"data"</span>: <span style="color: rgb(48, 128, 128);">[</span>
      <span style="color: rgb(64, 96, 128);">{</span>
        <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
        <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Email Support"</span>,
        <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
        <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
        <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);">"Email Support"</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);">"dba33a54-57dc-4a29-abf7-0a83aa7c1961"</span>
        <span style="color: rgb(64, 96, 128);">}</span>
      <span style="color: rgb(64, 96, 128);">}</span>,
      <span style="color: rgb(64, 96, 128);">{</span>
        <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
        <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Financial News Service"</span>,
        <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
        <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
        <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);">"Financial News 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);">"7de73a31-db39-4aa7-a8c2-8c1d325ec080"</span>
        <span style="color: rgb(64, 96, 128);">}</span>
      <span style="color: rgb(64, 96, 128);">}</span>,
      <span style="color: rgb(64, 96, 128);">{</span>
        <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
        <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"Indices Services"</span>,
        <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">2</span>,
        <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
        <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
        <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);">"Indices Services"</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);">"65531b5f-a1af-474e-8709-65f49b6c6ad8"</span>
        <span style="color: rgb(64, 96, 128);">}</span>
      <span style="color: rgb(64, 96, 128);">}</span>,
      <span style="color: rgb(64, 96, 128);">{</span>
        <span style="color: rgb(16, 96, 182);">"id"</span>: <span style="color: rgb(16, 96, 182);">"id"</span>,
        <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"feature"</span>,
        <span style="color: rgb(16, 96, 182);">"name"</span>: <span style="color: rgb(16, 96, 182);">"recurring"</span>,
        <span style="color: rgb(16, 96, 182);">"element_type"</span>: <span style="color: rgb(16, 96, 182);">"recurring"</span>,
        <span style="color: rgb(16, 96, 182);">"price"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"min_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"max_unit"</span>: <span style="color: rgb(0, 140, 0);">0</span>,
        <span style="color: rgb(16, 96, 182);">"period"</span>: <span style="color: rgb(16, 96, 182);">"monthly"</span>,
        <span style="color: rgb(16, 96, 182);">"billing_period_interval"</span>: <span style="color: rgb(0, 140, 0);">1</span>
      <span style="color: rgb(64, 96, 128);">}</span>
    <span style="color: rgb(48, 128, 128);">]</span>,
    <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"list"</span>,
    <span style="color: rgb(16, 96, 182);">"count"</span>: <span style="color: rgb(0, 140, 0);">4</span>,
    <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>
  <span style="color: rgb(64, 96, 128);">}</span>
<span style="color: rgb(64, 96, 128);">}</span>
<span style="color: rgb(48, 128, 128);">]</span>,
  <span style="color: rgb(16, 96, 182);">"object"</span>: <span style="color: rgb(16, 96, 182);">"list"</span>,
  <span style="color: rgb(16, 96, 182);">"count"</span>: <span style="color: rgb(0, 140, 0);">1</span>,
  <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>
}

Plan

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
<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>
  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”
  offering <span style="color: rgb(48, 128, 128);">=</span> Nurego::Offering<span style="color: rgb(48, 128, 128);">.</span>current({:segment_guid => '<code><SEGMENT></code>', :distribution_channel => '<code><CHANNEL></code>'})</p>

<p>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|
    <span style="color: rgb(64, 0, 0);">puts</span> plan<span style="color: rgb(48, 128, 128);">.</span>inspect
  <span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>
<span style="color: rgb(32, 0, 128); font-weight: bold;">end</span>