Class: Mints::Pub

Inherits:
Object
  • Object
show all
Defined in:
lib/pub.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (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, options = nil)
  return @client.raw("get", "/content/content-instances/#{slug}", options)
end

#content_instances(options) ⇒ Object



34
35
36
# File 'lib/pub.rb', line 34

def content_instances(options) 
  return @client.raw("get", "/content/content-instances", options)
end

#get_attributes(options = nil) ⇒ Object



103
104
105
# File 'lib/pub.rb', line 103

def get_attributes(options = nil)
  return @client.raw("get", "/config/attributes", options)
end

#get_categories(options = nil) ⇒ Object



87
88
89
# File 'lib/pub.rb', line 87

def get_categories(options = nil)
  return @client.raw("get", "/config/categories", options)
end

#get_category(slug, options = nil) ⇒ Object



91
92
93
# File 'lib/pub.rb', line 91

def get_category(slug, options = nil)
  return @client.raw("get", "/config/categories/#{slug}", options)
end

#get_content_page(slug, options = nil) ⇒ Object



22
23
24
# File 'lib/pub.rb', line 22

def get_content_page(slug, options = nil)
  return @client.raw("get", "/content-pages/#{slug}", options)
end

#get_content_template(slug, options = nil) ⇒ Object



30
31
32
# File 'lib/pub.rb', line 30

def get_content_template(slug, options = nil)
  return @client.raw("get", "/content/content-templates/#{slug}", options)
end

#get_content_templates(options = nil) ⇒ Object



26
27
28
# File 'lib/pub.rb', line 26

def get_content_templates(options = 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, options = nil)
  return @client.raw("get", "/content/forms/{slug}", options)
end

#get_forms(options = nil) ⇒ Object



51
52
53
# File 'lib/pub.rb', line 51

def get_forms(options = nil)
  return @client.raw("get", "/content/forms/{slug}", options)
end

#get_product(slug, options = nil) ⇒ Object



67
68
69
# File 'lib/pub.rb', line 67

def get_product(slug, options = nil)
  return @client.raw("get", "/ecommerce/products/#{slug}", options)
end

#get_product_brand(slug, options = nil) ⇒ Object



75
76
77
# File 'lib/pub.rb', line 75

def get_product_brand(slug, options = nil)
  return @client.raw("get", "/ecommerce/product-brands/#{slug}", options)
end

#get_product_brands(options = nil) ⇒ Object



71
72
73
# File 'lib/pub.rb', line 71

def get_product_brands(options = nil)
  return @client.raw("get", "/ecommerce/product-brands", options)
end

#get_products(options = nil) ⇒ Object



63
64
65
# File 'lib/pub.rb', line 63

def get_products(options = nil)
  return @client.raw("get", "/ecommerce/products", options)
end

#get_sku(slug, options = nil) ⇒ Object



83
84
85
# File 'lib/pub.rb', line 83

def get_sku(slug, options = nil)
  return @client.raw("get", "/ecommerce/skus/#{slug}", options)
end

#get_skus(options = nil) ⇒ Object



79
80
81
# File 'lib/pub.rb', line 79

def get_skus(options = nil)
  return @client.raw("get", "/ecommerce/skus", options)
end

#get_stories(options = nil) ⇒ Object



42
43
44
# File 'lib/pub.rb', line 42

def get_stories(options = nil)
  return @client.raw("get", "/content/stories", options)
end

#get_story(slug, options = nil) ⇒ Object



46
47
48
49
# File 'lib/pub.rb', line 46

def get_story(slug, options = nil)

  return @client.raw("get", "/content/stories/#{slug}", options)
end

#get_tag(slug, options = nil) ⇒ Object



99
100
101
# File 'lib/pub.rb', line 99

def get_tag(slug, options = nil)
  return @client.raw("get", "/config/tags/#{slug}", options)
end

#get_tags(options) ⇒ Object



95
96
97
# File 'lib/pub.rb', line 95

def get_tags(options)
  return @client.raw("get", "/config/tags", options)
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_timerObject



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