class AnetworkDynamicAd::Client
Attributes
setter and getter
setter and getter
setter and getter
setter and getter
Public Class Methods
Set token
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @param [string] token @return [void]
# File src/Client.rb, line 15 def initialize(token) @api_url = 'http://api.anetwork.ir/dynamicad/' @token = token end
Public Instance Methods
Delete record
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @param [integer] id @return [Json]
# File src/Client.rb, line 96 def delete(id) params = { _METHOD: 'DELETE', id: id } puts Request.http(@url,'POST',params) end
Get results
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @return [json]
# File src/Client.rb, line 110 def get puts Request.http(@url,'GET') end
Get by id
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @param [integer] id @return [Object]
# File src/Client.rb, line 49 def id(id) @url = "#{@url}&id=#{id}" self end
Insert records
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @param [Object] params @return [Json]
# File src/Client.rb, line 73 def insert(params) puts Request.http(@url,'POST',params) end
Set limit and offset
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @param [integer] limit @param [integer] offset
# File src/Client.rb, line 61 def limit(limit = 999,offset = 0) @url = "#{@url}&limit=#{limit}&offset=#{offset}" self end
Get logos
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @return [Object]
# File src/Client.rb, line 37 def logo @url = "#{@api_url}logo?token=#{@token}" self end
Get products
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @return [Object]
# File src/Client.rb, line 26 def product @url = "#{@api_url}?token=#{@token}" self end
Update records
@author Alireza Josheghani <a.josheghani@anetwork.ir> @since 24 Nov 2016 @param [Object] params @return [Json]
# File src/Client.rb, line 84 def update(params) params['_METHOD'] = 'PUT' puts Request.http(@url,'POST',params) end