Class: Hastests::Data

Inherits:
Service show all
Defined in:
lib/hastests/data.rb

Instance Method Summary collapse

Constructor Details

#initialize(script, account) ⇒ Data

Returns a new instance of Data.



12
13
14
15
# File 'lib/hastests/data.rb', line 12

def initialize(script,)
  @account = 
  @params = {:q => script, :api_token => @account.token }
end

Instance Method Details

#generate(seed = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/hastests/data.rb', line 17

def generate(seed=nil) 
  params = @params.clone
  if seed!=nil
    params[:seed]=seed
  end
  response = RestClient.get(@account.url + Hastests::API_PATH,
                            :user_agent => Hastests::USER_AGENT,
                            :params => params)
  return JSON.parse(response.body)
end