Class: Tickspot::Request

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

Class Method Summary collapse

Class Method Details

.post(options) ⇒ Array

Send a post request to Tickspot. Will use Tickspot.company and Tickspot.section to build the url and passes every op tion it received ( merged with Tickspot.email and Tickspot.password ) to HTTParty’s :query parameter. It’ll return everythin within the returned root node ( which is named equally to the section name ).

Parameters:

  • options (Hash)

    The options you want to pass.

Returns:

  • (Array)

    items An array of hashes with the item data.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tickspot.rb', line 22

def self.post(options)
  section = options.delete(:section)
  result = HTTParty.post(
    "https://#{Tickspot.company}.tickspot.com/api/#{section}",
    :query => options.merge({
      :email =>     Tickspot.email,
      :password =>  Tickspot.password
    })
  )
  result[section.to_s]
end