Class: SevenApi::Resources::Groups

Inherits:
SevenApi::Resource show all
Defined in:
lib/seven_api/resources/groups.rb,
lib/seven_api/resources/numbers.rb

Constant Summary

Constants inherited from SevenApi::Resource

SevenApi::Resource::BASE_PATH

Instance Attribute Summary

Attributes inherited from SevenApi::Resource

#api_key, #builder, #conn, #endpoint, #http_methods, #request_methods, #sent_with

Instance Method Summary collapse

Methods inherited from SevenApi::Resource

get_endpoint, get_http_methods, #initialize

Constructor Details

This class inherits a constructor from SevenApi::Resource

Instance Method Details

#activeArray

Retrieve active phone numbers read more: docs.seven.io/en/rest-api/endpoints/numbers#active-numbers

Returns:

  • (Array)


20
21
22
# File 'lib/seven_api/resources/numbers.rb', line 20

def active
  request({}, {}, '/active')
end

#all(params = {}) ⇒ Hash

Retrieve contacts associated with the API key read more: docs.seven.io/en/rest-api/endpoints/groups#list-all-groups

Parameters:

  • params (Hash) (defaults to: {})

Returns:

  • (Hash)


21
22
23
# File 'lib/seven_api/resources/groups.rb', line 21

def all(params = {})
  request(params)
end

#availableHash

Retrieve available phone numbers read more: docs.seven.io/en/rest-api/endpoints/numbers#available-numbers

Returns:

  • (Hash)


28
29
30
# File 'lib/seven_api/resources/numbers.rb', line 28

def available
  request(params, {}, '/available')
end

#create(params) ⇒ Hash

Parameters:

  • params (Hash)

Returns:

  • (Hash)


45
46
47
# File 'lib/seven_api/resources/groups.rb', line 45

def create(params)
  request( params)
end

#delete(number, delete_immediately = false) ⇒ Hash

Parameters:

  • number (String)

Returns:

  • (Hash)


37
38
39
# File 'lib/seven_api/resources/groups.rb', line 37

def delete(id)
  request({}, {}, "/#{id}")
end

#one(number) ⇒ Hash

Parameters:

  • number (String)

Returns:

  • (Hash)


29
30
31
# File 'lib/seven_api/resources/groups.rb', line 29

def one(id)
  request({}, {}, "/#{id}")
end

#order(number, payment_interval = PaymentInterval.ASCENDING) ⇒ Hash

Parameters:

  • number (String)
  • payment_interval (String) (defaults to: PaymentInterval.ASCENDING)

Returns:

  • (Hash)


37
38
39
40
41
42
43
# File 'lib/seven_api/resources/numbers.rb', line 37

def order(number, payment_interval = PaymentInterval.ASCENDING)
  payload = {
    number => number,
    payment_interval => payment_interval,
  }
  request(payload, {}, '/order')
end

#update(number, params) ⇒ Hash

Parameters:

  • number (String)
  • params (Hash)

Returns:

  • (Hash)


53
54
55
# File 'lib/seven_api/resources/groups.rb', line 53

def update(contact)
  request(contact, {}, "/#{contact['id']}")
end