Class: Zoho::Api::HostedPage

Inherits:
Request
  • Object
show all
Defined in:
lib/zoho/api/hosted_pages.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#attributes, #delete, delete, #get, get, #initialize, #post, post, #put, put

Constructor Details

This class inherits a constructor from Zoho::Request

Instance Attribute Details

#addonsObject

Returns the value of attribute addons.



2
3
4
# File 'lib/zoho/api/hosted_pages.rb', line 2

def addons
  @addons
end

#customerObject

Returns the value of attribute customer.



2
3
4
# File 'lib/zoho/api/hosted_pages.rb', line 2

def customer
  @customer
end

#planObject

Returns the value of attribute plan.



2
3
4
# File 'lib/zoho/api/hosted_pages.rb', line 2

def plan
  @plan
end

#redirect_urlObject

Returns the value of attribute redirect_url.



2
3
4
# File 'lib/zoho/api/hosted_pages.rb', line 2

def redirect_url
  @redirect_url
end

#subscription_idObject

Returns the value of attribute subscription_id.



2
3
4
# File 'lib/zoho/api/hosted_pages.rb', line 2

def subscription_id
  @subscription_id
end

Class Method Details

.allObject



20
21
22
23
24
25
26
27
28
# File 'lib/zoho/api/hosted_pages.rb', line 20

def all
  base_url = Zoho::Api::HOST+"/api/v1/hostedpages"
  response = Zoho::Request.get(base_url)
  if response.code == 0
    return response.hostedpages
  else
    return response
  end
end

.buy_onetime_addon(attrs = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/zoho/api/hosted_pages.rb', line 45

def buy_onetime_addon attrs={}
  hostpage = Zoho::Api::HostedPage.new(attrs)
  base_url = Zoho::Api::HOST+"/api/v1/hostedpages/buyonetimeaddon"
  response = post(base_url) do |http, request|
    request.body = hostpage.to_json
    response = http.request(request)
    response = JSON.parse(response.body, object_class: OpenStruct)
  end
  return response
end

.create_subscription(attrs = {}) ⇒ Object



40
41
42
43
# File 'lib/zoho/api/hosted_pages.rb', line 40

def create_subscription attrs={}
  hostpage = Zoho::Api::HostedPage.new(attrs)
  return hostpage.save
end

.find(page_id) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/zoho/api/hosted_pages.rb', line 30

def find page_id
  base_url = Zoho::Api::HOST+"/api/v1/hostedpages/#{page_id}"
  response = Zoho::Request.get(base_url)
  if response.code == 0
    return response.data
  else
    return response
  end
end

Instance Method Details

#find(hostpage_id) ⇒ Object



15
16
17
# File 'lib/zoho/api/hosted_pages.rb', line 15

def find hostpage_id
  return Zoho::Api::HostedPage.find(hostpage_id)
end

#saveObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/zoho/api/hosted_pages.rb', line 4

def save
  base_url = Zoho::Api::HOST+"/api/v1/hostedpages/newsubscription"
  response = post(base_url) do |http, request|
    request.body = self.to_json
    response = http.request(request)
    response = JSON.parse(response.body, object_class: OpenStruct)
  end

  return response
end