Class: Mints::Pub
- Inherits:
-
Object
- Object
- Mints::Pub
- Defined in:
- lib/pub.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #content_instance(slug, options = nil) ⇒ Object
- #content_instances(options) ⇒ Object
- #get_attributes(options = nil) ⇒ Object
- #get_categories(options = nil) ⇒ Object
- #get_category(slug, options = nil) ⇒ Object
- #get_content_page(slug, options = nil) ⇒ Object
- #get_content_template(slug, options = nil) ⇒ Object
- #get_content_templates(options = nil) ⇒ Object
- #get_form(slug, options = nil) ⇒ Object
- #get_forms(options = nil) ⇒ Object
- #get_product(slug, options = nil) ⇒ Object
- #get_product_brand(slug, options = nil) ⇒ Object
- #get_product_brands(options = nil) ⇒ Object
- #get_products(options = nil) ⇒ Object
- #get_sku(slug, options = nil) ⇒ Object
- #get_skus(options = nil) ⇒ Object
- #get_stories(options = nil) ⇒ Object
- #get_story(slug, options = nil) ⇒ Object
- #get_tag(slug, options = nil) ⇒ Object
- #get_tags(options) ⇒ Object
-
#initialize(host, api_key) ⇒ Pub
constructor
A new instance of Pub.
- #register_visit(ip, user_agent, url) ⇒ Object
- #register_visit_timer ⇒ Object
- #submit_form(data) ⇒ Object
Constructor Details
#initialize(host, api_key) ⇒ Pub
Returns a new instance of Pub.
5 6 7 |
# File 'lib/pub.rb', line 5 def initialize(host, api_key) @client = Mints::Client.new(host, api_key) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/pub.rb', line 4 def client @client end |
Instance Method Details
#content_instance(slug, options = nil) ⇒ Object
38 39 40 |
# File 'lib/pub.rb', line 38 def content_instance(slug, = nil) return @client.raw("get", "/content/content-instances/#{slug}", ) end |
#content_instances(options) ⇒ Object
34 35 36 |
# File 'lib/pub.rb', line 34 def content_instances() return @client.raw("get", "/content/content-instances", ) end |
#get_attributes(options = nil) ⇒ Object
103 104 105 |
# File 'lib/pub.rb', line 103 def get_attributes( = nil) return @client.raw("get", "/config/attributes", ) end |
#get_categories(options = nil) ⇒ Object
87 88 89 |
# File 'lib/pub.rb', line 87 def get_categories( = nil) return @client.raw("get", "/config/categories", ) end |
#get_category(slug, options = nil) ⇒ Object
91 92 93 |
# File 'lib/pub.rb', line 91 def get_category(slug, = nil) return @client.raw("get", "/config/categories/#{slug}", ) end |
#get_content_page(slug, options = nil) ⇒ Object
22 23 24 |
# File 'lib/pub.rb', line 22 def get_content_page(slug, = nil) return @client.raw("get", "/content-pages/#{slug}", ) end |
#get_content_template(slug, options = nil) ⇒ Object
30 31 32 |
# File 'lib/pub.rb', line 30 def get_content_template(slug, = nil) return @client.raw("get", "/content/content-templates/#{slug}", ) end |
#get_content_templates(options = nil) ⇒ Object
26 27 28 |
# File 'lib/pub.rb', line 26 def get_content_templates( = nil) return @client.raw("get", "/content/content-templates") end |
#get_form(slug, options = nil) ⇒ Object
55 56 57 |
# File 'lib/pub.rb', line 55 def get_form(slug, = nil) return @client.raw("get", "/content/forms/{slug}", ) end |
#get_forms(options = nil) ⇒ Object
51 52 53 |
# File 'lib/pub.rb', line 51 def get_forms( = nil) return @client.raw("get", "/content/forms/{slug}", ) end |
#get_product(slug, options = nil) ⇒ Object
67 68 69 |
# File 'lib/pub.rb', line 67 def get_product(slug, = nil) return @client.raw("get", "/ecommerce/products/#{slug}", ) end |
#get_product_brand(slug, options = nil) ⇒ Object
75 76 77 |
# File 'lib/pub.rb', line 75 def get_product_brand(slug, = nil) return @client.raw("get", "/ecommerce/product-brands/#{slug}", ) end |
#get_product_brands(options = nil) ⇒ Object
71 72 73 |
# File 'lib/pub.rb', line 71 def get_product_brands( = nil) return @client.raw("get", "/ecommerce/product-brands", ) end |
#get_products(options = nil) ⇒ Object
63 64 65 |
# File 'lib/pub.rb', line 63 def get_products( = nil) return @client.raw("get", "/ecommerce/products", ) end |
#get_sku(slug, options = nil) ⇒ Object
83 84 85 |
# File 'lib/pub.rb', line 83 def get_sku(slug, = nil) return @client.raw("get", "/ecommerce/skus/#{slug}", ) end |
#get_skus(options = nil) ⇒ Object
79 80 81 |
# File 'lib/pub.rb', line 79 def get_skus( = nil) return @client.raw("get", "/ecommerce/skus", ) end |
#get_stories(options = nil) ⇒ Object
42 43 44 |
# File 'lib/pub.rb', line 42 def get_stories( = nil) return @client.raw("get", "/content/stories", ) end |
#get_story(slug, options = nil) ⇒ Object
46 47 48 49 |
# File 'lib/pub.rb', line 46 def get_story(slug, = nil) return @client.raw("get", "/content/stories/#{slug}", ) end |
#get_tag(slug, options = nil) ⇒ Object
99 100 101 |
# File 'lib/pub.rb', line 99 def get_tag(slug, = nil) return @client.raw("get", "/config/tags/#{slug}", ) end |
#get_tags(options) ⇒ Object
95 96 97 |
# File 'lib/pub.rb', line 95 def () return @client.raw("get", "/config/tags", ) end |
#register_visit(ip, user_agent, url) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/pub.rb', line 9 def register_visit(ip, user_agent, url) data = { ip_address: ip, user_agent: user_agent, url: url } return @client.raw("post", "/register-visit-timer", nil, data) end |
#register_visit_timer ⇒ Object
18 19 20 |
# File 'lib/pub.rb', line 18 def register_visit_timer return @client.raw("get", "/register-visit-timer") end |
#submit_form(data) ⇒ Object
59 60 61 |
# File 'lib/pub.rb', line 59 def submit_form(data) return @client.raw("post", "/forms/store", nil, data) end |